HasGroup
The SD.HasGroup module offers a versatile and dynamic approach to verifying player affiliations or roles within various frameworks. This module adapts to multiple frameworks, such as ESX and QB/QBX, providing tailored checks for player groups based on predefined or dynamic criteria.
Overview
Purpose: Determines if a player belongs to specific groups or roles defined in a game's framework, which may include jobs, duties, or other organizational roles.
CheckForDuty: A configurable boolean that, when set to true, requires that players be on duty for their group affiliation to be recognized (relevant in certain contexts like law enforcement roles).
Parameters
source
(any
): The identifier for the player. Typically a server ID or similar unique identifier.filter
(string|table
): The group or groups to check against. Can be a single group name, an array of names, or a hash table specifying minimum grades for roles.
Filter Types
String: Direct comparison to a single group name.
Array: Check against multiple group names; the player must belong to at least one.
Hash: Maps group names to minimum grade levels the player must meet or exceed.
Usage Example
Checking Single Group Membership
Checking Membership in Any Listed Group
Checking Membership with Grade Requirements
Cop Callback
Last updated