Whitelist Use of Emergency Vehicles

0: Compacts 1: Sedans 2: SUVs 3: Coupes 4: Muscle 5: Sports Classics 6: Sports 7: Super 8: Motorcycles 9: Off-road 10: Industrial 11: Utility 12: Vans 13: Cycles 14: Boats 15: Helicopters 16: Planes 17: Service 18: Emergency 19: Military 20: Commercial 21: Trains

SEE the reference: https://runtime.fivem.net/doc/reference.html#_0x29439776AAA00A62

Unfortunately
mine doesnt work, here are the screenshots of ym resource.lua and client.lua

See any problems with this?

Oh my god, see how your code in client is :man_facepalming:

GOOD CODE HERE:
client.lua (677 Bytes)

Yes you can, i can help you if you want

still doesn’t work…

(20char)

If y’all want, i have released a.resource some time ago, just modify it and you should be ready to go, search it up here on the forums

1 Like

Show me your code, i assume you just used my code and changed nothing…

Indeed, but i aslo added the local police things

So the code all done:
client.lua (677 Bytes)

Just change the model skins

This is so confusing, im in a ped which isnt a cop and im driving cop cars…

@F3llout_4
Change:
if CheckSkin(ped) then

with

if not CheckSkin(ped) then

client.lua (677 Bytes)

@BabbaTundaee
Use this to check models bro:

local car = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if IsVehicleModel(car, GetHashKey("car_model_name",_r)) then

EDITED:
Also guys you can check what seat the player is:
if ( GetPedInVehicleSeat( GetVehiclePedIsIn(ped, false ), -1 ) then -- (This will check if it his in the driver seat)

is that script specific to a PED or to a job? I am using skinchanger with the freemode PED, so if it locks out the vehicle to any non-police PED than it wont do what im looking for. I dont mind customizing or modifying as needed to fit what im looking for, i just need a direction to go in

Server:

local cops = {
    'steam:110000105959047',
    --'license:1234975143578921327',
}

function isCop(player)
    local allowed = false
    for i,id in ipairs(cops) do
        for x,pid in ipairs(GetPlayerIdentifiers(player)) do
            if string.lower(pid) == string.lower(id) then
                allowed = true
            end
        end
    end
    return allowed
end

RegisterServerEvent('checkcop')
AddEventHandler('checkcop', function()
	local id = source
	if isCop(id) then
		TriggerClientEvent("setjob", source, 'cop')
	else
	    TriggerClientEvent("setjob", source, 'nocop')
	end
end)

Client

local job 

AddEventHandler("load", function()
	TriggerServerEvent( "checkcop")
end)

RegisterNetEvent('setjob')
AddEventHandler('setjob', function(j)
	print('job setted ' .. j)
	job = j
end)	

Citizen.CreateThread(function()
	while true do
		Citizen.Wait( 5000 )

		if NetworkIsSessionStarted() then
			TriggerEvent('load')
			return
		end
	end
end )



Yes it is for the skin, try check another class or the specific model.

My mistake… Is nice now, check if IsCop

What specific car are you trying to get?

I made a code getting a specific model car, “police”, give it a try
client.lua (793 Bytes)

Ok yeah, it works now I just need to set it to draw notification, maybe try and make it so it kicks them out of the vehicle.

To kick him just do this:

Vehpos= GetEntityCoords(car,  true)
  local xnew = Vehpos.x+2
  local ynew = Vehpos.y+2

  SetEntityCoords(GetPlayerPed(-1), xnew, ynew, Vehpos.z)

Why you create a event?
Just draw the notification right on the thread

EDIT:
And yes you can release :stuck_out_tongue_winking_eye:

Yeah I just noticed that, it all works but for some reason it still kicks me out even when I have my steam id added.