Exports
Here you will find all the useful exports for this asset, please read each step and example carefully to better understand how it works, we do not recommend using these if you are not an experienced developer.
REMEMBER ABOUT CLIENT SIDE AND SERVER SIDE IN CHOOSING EXPORT!
GetDutyData
To fetch player duty data you need to use following export.
exports['piotreq_jobcore']:GetDutyData()identifier
string
exports['piotreq_jobcore']:GetPlayerDutyData(identifier)Example of Usage
local data = exports['piotreq_jobcore']:GetDutyData()
print(json.encode(data, {indent=true}))
--[[
{
"status": 1,
}
]]local data = exports['piotreq_jobcore']:GetPlayerDutyData('char1:12345678')
print(json.encode(data, {indent=true}))
--[[
{
"identifier": "char1:12345678",
"player": 10,
"job": "police",
"status": 1,
"time": 500,
}
]]DutyPlayersTrigger
You can use this export to trigger some client event for players with specific job.
eventName
stringdata
any(args for event)job
stringonline?
boolean(if true then only trigger for players which are on duty else all players in table
Example of Usage
On Duty Update
With this event handler you are able to follow player duty updates.
ResetDutyTimer
You can use this export to reset duty time for specific player.
identifier
string
Example of Usage
ResetDutyTimers
With this export you can reset duty time for all players in specific job.
job
stringtype
string("all", "online", "offline")
Example of Usage
ToggleDuty
You can use following trigger to toggle duty status
duty
number(0 = off duty, 1 = on duty, 2 = break)
duty
number(0 = off duty, 1 = on duty, 2 = break)playerId
number
FormatDutyTime
Use following export to receive formatted duty time
time
number
Example of Usage
SavePlayerDutyTime
You can use this export to save player duty time manually.
identifier
stringtime
number
Example of Usage
isPlayerOnDuty
You can check if specific player is on duty with this export.
identifier
string
Example of Usage
GetJobDutyPlayers
With this export you are able to get all online players with specific job
job
string
Example of Usage
GetAllDutyPlayers
This export will get all online players with job from config
Example of Usage
SetPlayerDutyData
identifier
stringdata
tableplayerId
stringjobName
stringstatus
numbertime
numberstartTime?
number
Example of Usage
GetJobActivePlayers
This export will return on duty players count from specific job / jobs.
job
string / table
Example of Usage
Last updated