Map blips for player driven police cars

so, i do have a question. maybe someone of you has a hint for me.
i would love to mark police cars of players on the map with blips.
is there any existing script or can someone just point me into a direction?

thanks in advance <3

1 Like

You want everyone to see them or just other cops?

Just the cops. Won’t too good if you take hostage of a cop and his collegues can see him on the map :smiley:

If you’re using ESX then go to esx_policejob and open “config.lua”. From there go to line 17 and change it from false to true

Are you talking about the player blips?
i already know about those.
i dont’t want the ped to get displayed on the map but the cars.

So you’re wanting cops to see blips on the map of their cop car or all cop cars?

all cop cars.
i think i found the solution.
https://runtime.fivem.net/doc/natives/#_0x43286D561B72B8BF

This should work.

Hello, i was working on something like this a few weeks ago and after a few hours i think there is no way to make thing like that. I was sending netId of the police vehicle to all cops and adding it to a table, adding blip (tried both for coords and for entity) and it is all good if the vehicle is near you, if you get too far the vehicle is removed from your session and the blip is going to coords 0, 0, 0 at the center of the map, after getting back to the vehicle the blip is going back to be normal at the vehicle

1 Like

Did you try SetPoliceRadarBlips?

yes, it is not doing anything. Maybe it is working with peds while the AI cop is inside but not for players

Sorry if this sounds arrogant I’m new to scripting. What if you store the vehicle netid client side and pass the coords from each client (since they’re vehicle should be in range) to the server and draw blips based on a table of coords. Would this be too inefficient/laggy?

yes, in my opinion doing a check on every client and passing the info (if vehicle is found) to server to store it in a table and then sending that table to all police officers would be pointless in my opinion, and yet if there will be like 3 - 8 players the problem will still be there (blips on the center)

Hey have you ever found the script that you can see police vehicles but not the police officer itself? Looking for it but can’t seem to find it… Otherwise i’ll do some coding myself :slight_smile:

Well, why don’t you check if the cop has an radio on him? I think thats more realistic, then they are still on the map unless a criminal takes his radio.

Once it updates the position make a server callback check and give the id of the player with it, then check in the callback if the player has an radio on him and based on that callback a boolean (true/false)

Try this, this will add a police car blip on the police vehicle that a player is using and remove it when he/she leaves the car or an npc is driving it. Note that this is for ANY player driving a police vehicle, not just cops.




Citizen.CreateThread(function ()
while true do
Citizen.Wait(0)
	for _, veh in ipairs(GetGamePool('CVehicle')) do
		if DoesEntityExist(veh) and GetVehicleClass(veh) == 18 then
             driver = GetPedInVehicleSeat(veh, -1)
                if DoesEntityExist(driver) and IsPedAPlayer(driver) and not driver == 0 and IsPedInAnyPoliceVehicle(driver) then
                   bliptemp = GetBlipFromEntity(veh)
							if not DoesBlipExist(bliptemp) then
							blippolice = AddBlipForEntity(veh)
							SetBlipSprite(blippolice, 56) -- https://docs.fivem.net/docs/game-references/blips/
							SetBlipAsShortRange(blippolice, true)
							SetBlipRoute(blippolice, false)
							AddTextEntry('BLIPPOLICE', 'Police Vehicle')
							BeginTextCommandSetBlipName('BLIPPOLICE')
							EndTextCommandSetBlipName(blippolice)
							end
				end
		end
	end
end
end)

Citizen.CreateThread(function ()
while true do
Citizen.Wait(0)
	for _, veh2 in ipairs(GetGamePool('CVehicle')) do
		if DoesEntityExist(veh2) and GetVehicleClass(veh2) == 18 then
             driver2 = GetPedInVehicleSeat(veh2, -1)
                if driver2 == 0 or not IsPedAPlayer(driver2) then
				bliptemp2 = GetBlipFromEntity(veh2)
					if DoesBlipExist(bliptemp2) and GetBlipSprite(bliptemp2) == 56 then
						RemoveBlip(bliptemp2)
				   end
				end
		end
	end
end
end)