Duty System Exports
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
SetPlayerDuty(source: number, value: boolean|string|nil): void
Sets the duty status for a player.
source
(number
): The player's server ID.
value
(boolean|string|nil
):
true
— Puts the player on duty.
false
— Takes the player off duty.
string
— Represents a region (for regional duty).
nil
— Toggles the current duty status.
If duty is toggled on and the society has regional duty enabled, it will prompt the client to select a region.
If toggled off, the player is removed from the onDuty
cache.
Sends a Discord webhook for logging based on the status change.
SetPlayerDuty(23, true) -- Force player ID 23 on duty
SetPlayerDuty(23, false) -- Force player ID 23 off duty
SetPlayerDuty(23, nil) -- Toggle duty status for player ID 23
SetPlayerDuty(23, "Valentine") -- Set player on regional duty (if enabled)
IsPlayerOnDuty(source: number): boolean, string|nil, any
Checks if a player is currently on duty.
source
(number
): The player's server ID.
boolean
— Whether the player is on duty.
string|nil
— The job name (if on duty).
any
— The region or... true if on duty, else nil.
local isOnDuty, job, region = IsPlayerOnDuty(23)
print(isOnDuty, job, region)
true "police" "Valentine"
GetPlayersOnDuty(society: string, aslist: boolean, region?: string): table
Returns a list or table of players currently on duty for a specific society.
society
(string
): The society (job) name.
aslist
(boolean
):
true
— Returns a flat list ({sourceID1, sourceID2, ...}
)
false
— Returns a key-value map ({sourceID = region, ...}
)
region
(string
, optional): If provided, filters by this region.
table
: A list or map of players on duty, depending on aslist
.
local policeOnDuty = GetPlayersOnDuty("police", true)
print(json.encode(policeOnDuty))
Output:
{ 12, 33, 45 }
local valentinePolice = GetPlayersOnDuty("police", true, "Valentine")
print(json.encode(valentinePolice))
Output:
{ 12, 33 }
local detailedDutyMap = GetPlayersOnDuty("police", false)
print(json.encode(detailedDutyMap))
Output:
{
["12"] = "Valentine",
["33"] = "Valentine",
["45"] = "Rhodes"
}
local detailedDutyMap = GetPlayersOnDuty("blackwater_general", false)
print(json.encode(detailedDutyMap))
Output:
{
["12"] = true,
["33"] = true,
["45"] = true
}