[Release] Speedcamera


so um is this working or not for online players yet


until nex update it work,only for npc.


are you ever going to update?


I noticed as well that it only works on NPC’s.

Is there a way to fix this yet? :slight_smile:


To get players, I would suggest checking the nearby area (radius) for players, if there are any then check whether they are in a vehicle. Then return the closest one and display the speed and model of car for that vehicle :slight_smile:
Let me know if you’d like help with the code


Wow great, thanks man


Get vehicle of player
local Veh = GetVehiclePedIsIn(GetPlayerPed(GetPlayerFromServerId(PID)), false)

where would I add that in the script


Why not work for players ?


Is there a way to freeze the info on the screen? It only appears for a few seconds as the vehicle goes bye. It would be very helpful to have it remain while pursing.



Did you figure out how to check the speed of actual players and not just NPCs?


this script has not been updated in a long time unfortunately


Something like this should work:

function GetNearPlayerSpeed()
    local closePlayers = {}
	local thisPlayer
	local distance
        for i = 0, 32 do
                if NetworkIsPlayerActive(i) then
			thisPlayer = GetPlayerPed(closePlayers[i])
			distance = GetDistanceBetweenCoords(GetEntityCoords(thisPlayer),GetEntityCoords(GetPlayerPed(-1)))
			if distance <= 20 then
				if IsPedInAnyVehicle(thisPlayer, false) then
					return GetVehiclePedIsIn(thisPlayer, false)
                                        return false

You would just have to call the function at some point in the code and the results from it would be the vehicle’s speed.


Wish there were a way to freeze info onscreen until speedcamera is used again. Also, when i set the value in the .lua to change the hotkey, speedcamera doens’t work at all… wonder what that’s all about.


Hey everyone been 2 weeks just trying again.
Is there anything in the script i can edit to keep the vehicle info on my screen?
It’s only listed for about 2 seconds then disappears.



EDIT: Added freeze ability.
EDIT2: Fixed freeze, position, and wait.

Try this out. Haven’t tested it but it should work. Let me know if it does not.

Replace speedcamera.lua

--script by devilkkw
local radar = {shown = false, freeze = false, info = "none", minSpeed = 10.0, maxSpeed = 40.0}

function drawTxt(x,y ,width,height,scale, text, r,g,b,a)
    SetTextScale(scale, scale)
    SetTextColour(r, g, b, a)
    SetTextDropShadow(0, 0, 0, 0,255)
    SetTextEdge(1, 0, 0, 0, 255)
    DrawText(x - width/2, y - height/2 + 0.005)

	while true do
		if IsControlPressed(1, 217)then -- Caps Lock
			if radar.shown then radar.shown = false else radar.shown = true end
		if IsControlPressed(1, 38)then -- E
			if radar.freeze then radar.freeze = false else radar.freeze = true end
		if radar.shown then
			if radar.freeze == false then
				local pos = GetEntityCoords(GetPlayerPed(-1))
				local carM = GetClosestVehicle(pos['x'], pos['y'], pos['z'], 10.0,0,70)
				if carM ~= nil then
					local plate = GetVehicleNumberPlateText(carM)
					local vehSpeedKM = GetEntitySpeed(carM)*3.6
					local vehSpeedMph = GetEntitySpeed(carM)*2.236936
					if vehSpeedKM > radar.minSpeed then			  
						if vehSpeedKM < radar.maxSpeed then 
							radar.info = string.format("~b~Plate:~w~ %s ~n~~y~Km/h: ~g~%s~n~~y~Mph: ~g~%s",plate,math.ceil(vehSpeedKM),math.ceil(vehSpeedMph) )
							radar.info = string.format("~b~Plate:~w~ %s ~n~~y~Km/h: ~r~%s~n~~y~Mph: ~r~%s",plate,math.ceil(vehSpeedKM),math.ceil(vehSpeedMph) )


Cosmo is this in response to my request for a static display after running the speed gun? Or in response to others’ request for it to call Player info?
Either way, thanks for helping contribute to the community!


All for you @RPPerry3, it should display the last vehicle caught on radar. Although it is constantly scanning now instead of per key press, I could edit it to be per key press though.

I could incorporate the player info if someone really wanted, but I already posted the relevant code above if someone wanted to add it in.


@Cosmo I cannot thank you enough Cosmo, Other than expressing my gratitude!

What I’m ideally after, is the ability to run radar and freeze the information on screen. That way I can perform the traffic stop with the info present. Then after completing the traffic stop I can go back to running speed radar and continue to scan other motorists.

I guess in a perfect world, the radar would run automatically and I could press a key to freeze info until i need to use it again. Hope this makes sense.


Per Key Press is just fine! The most important thing is being able to freeze the info so we can have it to run information during a traffic stop. Thanks so much again!


Yeah that’s what I assumed after I changed it haha. Well I updated the code I posted above so that I wasn’t posting a big block of code again. Pressing ‘E’ should pause the radar scanning until you press ‘E’ again. You can change the specific button by changing the 38. @RPPerry3