pScripts
  • INFORMATION
    • FiveM Asset Escrow System
    • Assets Updates
    • Discord Roles
  • Assets & Guides
    • 🏛️Banking
      • 👋Installation Guide
      • ⚙️Editable Files
      • Client Exports
      • Server Exports
    • 👨‍⚖️DOJ Job
      • 👋Installation Guide
      • ⚙️Config Files
      • Client Exports
      • Server Exports
    • 💻DOJ MDT
      • 👋Installation Guide
      • ⚙️Config Files
      • Client Exports
      • Server Exports
    • 🌿Weed Plants
      • 👋Installation Guide
      • ⚙️Config Files
      • Client Exports
      • Server Exports
    • 🚗Car Sale Job
      • 👋Installation Guide
      • ⚙️Config File
      • Client Exports
      • Server Exports
    • 📙Job Core
      • ⚙️Config File
      • Exports
    • 👮Police Job
      • 👋Installation Guide
      • ⚠️Common Issues
      • ⁉️Setup Server
      • ⚙️Config Files
      • Client Exports
        • Bodycam
        • Evidence System
        • Duty GPS
        • Interactions
        • Jail System
        • Police Objects
        • Speed Camera
        • Manage Traffic
        • Misc
      • Server Exports
        • Evidence System
        • Interactions
        • Jail System
        • Misc
    • 💻Police MDT
      • ⁉️Setup Server
      • ⚙️Config File
      • Client Exports
      • Server Exports
      • Dispatch System
    • 🚑Ambulance Job
      • 👋Installation Guide
      • ⁉️Setup Server
      • ⚙️Config Files
      • Client Exports
      • Server Exports
    • 💻Ambulance MDT
      • 👋Installation Guide
      • ⚙️Config File
      • Exports and Events
      • Dispatch System
    • 🛠️Mechanic Job
      • ⚙️Config Files
      • Mileage System
      • Nitro System
      • Lifters System
      • Misc
    • 💻Mechanic MDT
      • ⚙️Config File
      • Exports
      • Dispatch System
      • Licenses System
    • 💵Fleeca Robbery
      • 👋Installation Guide
      • ⚙️Config File
    • ⌚Jewelry Robbery
      • 👋Installation Guide
      • ⚙️Config File
    • 💇Appearance
      • ⚙️Config Files
      • Client Exports
    • 👀Hints
      • Exports
    • 👋Helper
      • Exports
    • 🔧Tuning Menu
      • Exports and Events
      • ⚙️Config Files
    • 🆔Documents
      • ⚙️Config File
      • Exports and Events
    • 📱Phone
      • ⤵️INSTALLATION
      • ⚙️CONFIG FILES
      • 📃FEATURES
      • 📱APPS
      • 📇SIM CARDS
      • 📳NOTIFICATIONS
      • 📨MESSAGES
      • 🚘GARAGES
      • 🪙CRYPTO
      • 🔪DARK CONNECT
      • ⌨️FUNCTIONS
      • 🌎LANGUAGE
      • ⚠️COMMON ISSUES
    • 🪙Casino Games
      • 🎰Slot Machine
      • 🏐Roulette
      • ♣️Poker
    • 💻GCT
      • 📨EXPORTS
    • 💻Civil MDT
      • ⤵️INSTALLATION
      • 📱APPS
      • 🏎️BOOSTING
      • 🏅ACHIEVEMENTS
      • ⚠️COMMON ISSUES
Powered by GitBook
On this page
  • GetDutyData
  • Example of Usage
  • DutyPlayersTrigger
  • Example of Usage
  • On Duty Update
  • ResetDutyTimer
  • Example of Usage
  • ResetDutyTimers
  • Example of Usage
  • ToggleDuty
  • FormatDutyTime
  • Example of Usage
  • SavePlayerDutyTime
  • Example of Usage
  • isPlayerOnDuty
  • Example of Usage
  • GetJobDutyPlayers
  • Example of Usage
  • GetAllDutyPlayers
  • Example of Usage
  • SetPlayerDutyData
  • Example of Usage
  • GetJobActivePlayers
  • Example of Usage
  1. Assets & Guides
  2. Job Core

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 string

  • data any (args for event)

  • job string

  • online? boolean (if true then only trigger for players which are on duty else all players in table

exports['piotreq_jobcore']:DutyPlayersTrigger(eventName, data, job, online)

Example of Usage

local eventName = 'restaurants:refreshOrders'
local data = {'Order'}
local job = 'burgershot'
local online = true

exports['piotreq_jobcore']:DutyPlayersTrigger(eventName, data, job, online)

On Duty Update

With this event handler you are able to follow player duty updates.

AddEventHandler('piotreq_jobcore:UpdateDuty', function(data)
    print(json.encode(data))
end)
AddEventHandler('piotreq_gpt:UpdateDuty', function(player, data)
    print(player, json.encode(data))
end)

ResetDutyTimer

You can use this export to reset duty time for specific player.

  • identifier string

exports['piotreq_jobcore']:ResetDutyTimer(identifier)

Example of Usage

exports['piotreq_jobcore']:ResetDutyTimer('char:12345678')

ResetDutyTimers

With this export you can reset duty time for all players in specific job.

  • job string

  • type string ("all", "online", "offline")

exports['piotreq_jobcore']:ResetDutyTimers({
   job = job,
   type = type
})

Example of Usage

exports['piotreq_jobcore']:ResetDutyTimers({
   job = 'police',
   type = 'all'
})

ToggleDuty

You can use following trigger to toggle duty status

  • duty number (0 = off duty, 1 = on duty, 2 = break)

TriggerServerEvent('piotreq_jobcore:SwitchDuty', {duty = 1})
  • duty number (0 = off duty, 1 = on duty, 2 = break)

  • playerId number

exports['piotreq_jobcore']:SwitchDuty(playerId, {duty = 1})

FormatDutyTime

Use following export to receive formatted duty time

  • time number

exports['piotreq_jobcore']:FormatDutyTime(time)

Example of Usage

local time = 100
local formattedTime = exports['piotreq_jobcore']:FormatDutyTime(time)
print(formattedTime)

SavePlayerDutyTime

You can use this export to save player duty time manually.

  • identifier string

  • time number

exports['piotreq_jobcore']:SavePlayerDutyTime(identifier, time)

Example of Usage

local identifier = 'char:123456789' -- replace it with player identifier
local time = 100 -- replace it with player duty time

exports['piotreq_jobcore']:SavePlayerDutyTime(identifier, time)

isPlayerOnDuty

You can check if specific player is on duty with this export.

  • identifier string

exports['piotreq_jobcore']:isPlayerOnDuty(identifier)

Example of Usage

local identifier = 'char:123456789' -- replace this with player identifier

local result = exports['piotreq_jobcore']:isPlayerOnDuty(identifier)
print(result)

GetJobDutyPlayers

With this export you are able to get all online players with specific job

  • job string

exports['piotreq_jobcore']:GetJobDutyPlayers(job)

Example of Usage

local job = 'police'
local players = exports['piotreq_jobcore']:GetJobDutyPlayers(job)
print(json.encode(players, {indent=true}))

GetAllDutyPlayers

This export will get all online players with job from config

exports['piotreq_jobcore']:GetAllDutyPlayers()

Example of Usage

local players = iotreq_jobcore']:GetAllDutyPlayers()
print(json.encode(players, {indent=true}))

SetPlayerDutyData

  • identifier string

  • data table

  • playerId string

  • jobName string

  • status number

  • time number

  • startTime? number

exports['piotreq_jobcore']:SetPlayerDutyData(identifier, {
   identifier = identifier,
   player = playerId,
   job = jobName,
   status = status,
   time = time,
   startTime = startTime
})

Example of Usage

local identifier = 'char1:1234578' -- replace this with player identifier
local playerId = 1 -- replace it with player id
local jobName = 'police' -- replace it with player job
local status = 1 -- (0 = off duty, 1 = on duty, 2 = on break)
local time = 100 -- replace it with player duty time
local startTime = os.time() -- should be os.time every time

exports['piotreq_jobcore']:SetPlayerDutyData(identifier, {
   identifier = identifier,
   player = playerId,
   job = jobName,
   status = status,
   time = time,
   startTime = startTime
})

GetJobActivePlayers

This export will return on duty players count from specific job / jobs.

  • job string / table

exports['piotreq_jobcore']:GetJobActivePlayers(job)

Example of Usage

local job = 'police'
-- local job = {'police', 'ambulance', 'sheriff'} -- it can be table

local count = exports['piotreq_jobcore']:GetJobActivePlayers(job)
print(count)
PreviousConfig FileNextPolice Job

Last updated 4 months ago

📙