EZ Scripts
DiscordTebex
  • 💡Welcome To EZ Scripts
  • 🛡️Ez Admin Authority
    • Config File
  • 🫳Ez Item Spawner
    • Config File
    • Permission Check
    • Add Item
    • Get Items
  • FIVEM
    • 🍀EZ White Widow
      • Config File
      • Add more locations
      • Common Issues
    • 🟣EZ Lean Drug
      • Config File
      • Add more locations
    • 🛡️Ez Admin Authority
    • 🔠EZ Plate Changer
      • Config File
    • 📑Ez Lib
      • Config File
    • ❄️EZ Coke & Crack Drug
      • Config File
      • Add more locations
    • 🫳Ez Item Spawner
  • RedM
    • 💼EZ Society & Job Menu
      • Config File
      • Exports
        • Duty System Exports
      • Syn Society
    • 🌍EZ Fast Travel
      • Config File
    • 🍖Ez Consumables
      • Config File
    • 📺Ez HUD
      • Config File
      • Exports and Events
    • 🛡️Ez Admin Authority
    • 🚷EZ Combat Logging
      • Config File
    • 🗽EZ Life Style
      • Getting Life Style
      • Config File
    • ☢️EZ Radial Menu
      • Config File
    • 🫳Ez Item Spawner
    • ❓Ez Report Menu
      • Config File
Powered by GitBook
On this page
  1. RedM
  2. 💼EZ Society & Job Menu
  3. Exports

Duty System Exports

PreviousExportsNextSyn Society

Last updated 25 days ago

Was this helpful?

CtrlK
  • SetPlayerDuty(source: number, value: boolean|string|nil): void
  • IsPlayerOnDuty(source: number): boolean, string|nil, any
  • GetPlayersOnDuty(society: string, aslist: boolean, region?: string): table

Was this helpful?

SetPlayerDuty(source: number, value: boolean|string|nil): void

Sets the duty status for a player.

Parameters

  • 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.

Behavior

  • 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.

Example

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.

Parameters

  • source (number): The player's server ID.

Returns

  • 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.

Example

local isOnDuty, job, region = IsPlayerOnDuty(23)
print(isOnDuty, job, region)

Example Output

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.

Parameters

  • 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.

Returns

  • table: A list or map of players on duty, depending on aslist.

Example 1: Get list of player IDs on duty for police

local policeOnDuty = GetPlayersOnDuty("police", true)
print(json.encode(policeOnDuty))

Output:

{ 12, 33, 45 }

Example 2: Get list of player IDs on duty in a specific region

local valentinePolice = GetPlayersOnDuty("police", true, "Valentine")
print(json.encode(valentinePolice))

Output:

{ 12, 33 }

Example 3: Get map of players and their regions

local detailedDutyMap = GetPlayersOnDuty("police", false)
print(json.encode(detailedDutyMap))

Output:

{
  ["12"] = "Valentine",
  ["33"] = "Valentine",
  ["45"] = "Rhodes"
}

Example 4: Get map of players

local detailedDutyMap = GetPlayersOnDuty("blackwater_general", false)
print(json.encode(detailedDutyMap))

Output:

{
  ["12"] = true,
  ["33"] = true,
  ["45"] = true
}