[ESX] On / Off Duty Script

not working in zap server bro… in database nothing is happening

Could someone help

i have downloaded the scipt and put it in my server i am using esx_police and Pnotify
but when i go to go off duty nothing happens i used the sql and put it in my data base and still nothing

Bro, without an error code noone will help you. If you followed the instructions, it should work.

i dont get an error code

good script. Just found yet, and working perfectly. But very good it will be if you can set off-duty on duty amount like 2 or 3 cause i wanted to put in paleto and sandy

what police job are you using

can someone help me with this
script error: @esx_duty/clientmain.lua:10: invalid vector field: getplayerdata

Hi, the skript work fine, only the offduty people are not show in the employeer list. is there a way to add this?

@qalle Is there an version for mechanic job?

I had posted a long ago some solutions for the code performance. This is a new improvement for server side.

Than having too many events registered, you can have only (1) event that handles everything than creating an event for every job… much more efficient and understandable.

RegisterServerEvent('duty:changeDutyStatus') 
AddEventHandler('duty:changeDutyStatus', function()

    local _source = source
    local xPlayer = ESX.GetPlayerFromId(_source)

    if xPlayer.job.name then

        local jobName = xPlayer.job.name 

        if string.match(jobName, "off") then 
            jobName = jobName:gsub("%off", "") xPlayer.setJob(jobName, xPlayer.job.grade)
        else
            xPlayer.setJob('off' .. jobName, xPlayer.job.grade)
        end
    else
        print("[Error] Player has no job to perform this action.")
    end
end)

This event, its changing a job status from offduty, to onduty. Keep in mind, if it doesnt work, that means some jobs of your database have not created as “offduty”

I will probably make a script if you guys want about that.

please make this :stuck_out_tongue:

Hi. Just wondering how do i add custom jobs to this as i have tried but cannot get it working. Any help would be appriciated. Thanks

is there any vids on how to install this??

I have a error, please help! I hit the E but it doesn’t work

This information doesnt help at all.

What Artifacts are you using?
Linux/Windows?
ESX Version
Any Errors in client/server console?

I´ve got a problem…my officers and my medics can´t go offduty…any solutions?

great script, just had to change stuff in the config and server/main.lua

wher can i get the sql plz

yeah you can add cardealer on duty and off duty