[RELEASE] Police ALPR

is it possible to use it as KMh ?

Of course you can, just modify the MPH calculation into your KMH calculation, this:

GetEntitySpeed(e)*2.236936

and of course modify the text.

Can you add Kmh to the script? :smiley:

I’m having the issue of it disappearing. It appears and then goes away. Same as @SolarFantom

That might sound stupid, but if you are driving with a controller, ‘numpad5’ is also ‘left dpad down’ (or something else if you changed it)
So it could be that your are moving your car to the left and to the right, and you are tapping it down a little bit that it disappears.
I used this script for 2 Months ( also edited it at little bit :wink: )and I never had problems.

@Brock70
A very simple but good script!

This is really strange, there’s nothing in the code that could cause from my knowledge. I have this resource running on multiple communities with no complaints. Have you tried switching the keys used to see if maybe as Nathro stated it could be control messing it up or something else.

1 Like

Can someone please list the codes for moving it to the right bottom corner please?

How do I increase the range? Here?

@Brock70 do you think you can give me the location on where you got that mod for showing both mph & kmh?

How do you change the key for enabling it and freezing it?

if IsControlJustPressed(1, 127) and IsPedInAnyPoliceVehicle(GetPlayerPed(-1)) then

Should be as simple as adding another local for it. Look around lines 57-71 for reference

if radar.shown then
if radar.freeze == false then
local veh = GetVehiclePedIsIn(GetPlayerPed(-1), false)
local coordA = GetOffsetFromEntityInWorldCoords(veh, 0.0, 1.0, 1.0)
local coordB = GetOffsetFromEntityInWorldCoords(veh, 0.0, 105.0, 0.0)
local frontcar = StartShapeTestCapsule(coordA, coordB, 3.0, 10, veh, 7)
local a, b, c, d, e = GetShapeTestResult(frontcar)
if IsEntityAVehicle(e) then
local fmodel = GetDisplayNameFromVehicleModel(GetEntityModel(e))
local fvspeed = GetEntitySpeed(e)*2.236936
local fvkmh = GetEntitySpeed(e)*3.6 -- kmh variable being added
local fplate = GetVehicleNumberPlateText(e)
radar.info = string.format("~y~Plate: ~w~%s ~y~Model: ~w~%s ~y~Speed: ~w~%s mph ~y~/ ~w~%s kmh", fplate, fmodel, math.ceil(fvspeed), math.ceil(fvkmh)) --added kmh
end

Do the same for the rear radar’s code right below (lines 73-85) it and it should display MPH & KMH as well.

Someone let me know if it works, I don’t have a dev environment to test it on myself.

Where can I get a list of the codes for keys?

Here is a list of all the keys and their numerical values

https://wiki.fivem.net/wiki/Controls

How would I go about making it so that I can type a command in the chat box and have it hide the ALPR?
Aswell as changing the color for the text: “model, plate and speed”

Is there a way to get this to recognize add on police vehicles? I have police 2-11 in my city

2 Likes

To combine them, do you use a comma? (i.e. IsControlJustReleased(1, 51, 28)

What are you trying to do? Add it where you press both at the same time?

Yeah. Discovered you just use the ‘and’ keyword