[Request] an ESX script that prevents people from stealing emergency vehicles based on their jobs... Read for more info :)

I am looking for a script that prevents people from driving emergency vehicles based on what job they are, so if they are police for example, they can drive police cars, but if someone is a taxi driver and tries to drive a police car, it wont let them and then kicks them out of the car.
I know this one already exists:

but sad part is that that one kicks the player out from the SERVER instead of the CAR…

It’s not hard to modify that lol

well i dont know shit about coding alright? that’s why i put [request] in the title

closely observes code in client.lua from ESX_GetOut
pauses to think
comprehends code and contemplates utilizing common sense
comments out line 24

hmmm… would be neat if you could put in specific vehicles instead of the whole category tooo… so like cgheli for ‘army’ (its coast guard helicopter) and then maybe police3 for ‘police’ and etc…

im not good at explaining things lmao

Again, you could. Just get the hashes of the vehicles and check the current vehicle against that list of hashes, possibly using something like

if GetHashKey(GetVehiclePedIsIn(ped, false)) ~= vehicle_hash then
   -- do something
end

Could also use a table for them all instead of a carp ton of or's or elseif's

Well yea. That’s what I meant. Thanks bud @FAXES :grinning:

1 Like

so here it would be like

if GetHashKey(GetVehiclePedIsIn(ped, false)) ~= vehicle_hash then
– police1, police2 or?
end