[ESX] On / Off Duty Script

Hello, i’ve made this script to have a better RP experience, this is made to do if you’re a policeofficer and you are offduty instead of getting massive spams off police calls etc. you can go offduty.

Pictures

There is a tutorial how to download in the readme.md
pNotify is required if you want notifications

Download

Github
esx_duty.rar (27.4 KB)

31 Likes

I admire the thought of this script even if I don’t use it so… LIKED
I’ll give it a look either way, Thank you for sharing.

+1


Keep UP

Can this work for VRP? If not can you make it work for VRP?

hello small error in the sql file

INSERT INTO `jobs` (name, label) VALUES
  ('offpolice','Off-Duty'),
  ('offambulance','Off-Duty'),
;

INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
  ('offpolice',0,'recruit','Recruit',12,'{}','{}'),
  ('offpolice',1,'officer','Officer',24,'{}','{}'),
  ('offpolice',2,'sergeant','Sergeant',36,'{}','{}'),
  ('offpolice',3,'lieutenant','Lieutenant',48,'{}','{}'),
  ('offpolice',4,'boss','Boss',0,'{}','{}'),
  ('offambulance',0,'ambulance','Ambulance',12,'{}','{}'),
  ('offambulance',1,'doctor','Doctor',24,'{}','{}'),
  ('offambulance',2,'chief_doctor','Chef',36,'{}','{}'),
  ('offambulance',3,'boss','Boss',48,'{}','{}'),

two “,” miss

Try this

INSERT INTO `jobs` (name, label) VALUES
  ('offpolice','Off-Duty'),
  ('offambulance','Off-Duty')
;

INSERT INTO `job_grades` (job_name, grade, name, label, salary, skin_male, skin_female) VALUES
  ('offpolice',0,'recruit','Recruit',12,'{}','{}'),
  ('offpolice',1,'officer','Officer',24,'{}','{}'),
  ('offpolice',2,'sergeant','Sergeant',36,'{}','{}'),
  ('offpolice',3,'lieutenant','Lieutenant',48,'{}','{}'),
  ('offpolice',4,'boss','Boss',0,'{}','{}'),
  ('offambulance',0,'ambulance','Ambulance',12,'{}','{}'),
  ('offambulance',1,'doctor','Doctor',24,'{}','{}'),
  ('offambulance',2,'chief_doctor','Chef',36,'{}','{}'),
  ('offambulance',3,'boss','Boss',48,'{}','{}')
;

Thanks for telling me, updated sql.

Mine won’t go to off duty it only show’s the notification.
image

1 Like

You have the right jobs supported in the sql?
offambulance and offpolice

how you get the offpolice job

yes. but it only show’s the notification and doesn’t but off-duty job to me.

I got it to work, i didn’t had right job grades in server.main.lua :smiley:

1 Like

sql in script located in the folder you download

Hay I was wondering if can make it where instead giving them offpolice/offambulance…
why not set them up with the original unemployed.


Would be really helpful.
;D

Just edit all the offambulance and offpolice to unemployed in server.lua

I thought about that but can players able to do any other kind of jobs ex: taxi and still be able to get back on police duty…

Thats true, :stuck_out_tongue: … 20char

So…do u have any solution to that
or
I might have to look in that…See if i can do any help

You need a more custom solution for something like that to be honest, this is with out doubt not something this script will be able to help you with :slightly_smiling_face:

The way this works, is to set your job to something like “offpolice” “3” just the number of the head role - when going back in to the cirkle, this will be changed to police 3 again, so you get your on duty tag on again.

What you need is something in the db called main job, allowing a user to toggle back to there main job if they took another job, and that is a totally different thing then what this script dos currently with out doubt.

Hi,

Why not just adding a new column onduty(in users) next the job name with a defaut value set to 0.

A client script
If justcontrolreleased (0, whatyouwant) then
Triggerserverevent(onduty, true of false)
end

A server script
check the source mysql onduty column
if onduty==false then
onduty=true
UPDATE mysql
else
onduty=false
UPDATE mysqll
end

Then change all the conditions for the police like:
if (PlayerData.job~=nil and PlayerData.job.name==‘police’ and PlayerData.onduty==true) then

end

What do you think about it. For sure it needs some modifications but with a CTRL+F it’s easy and quick to implement these modifications.

BR

1 Like