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?
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
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.
Thanks,
P
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)
else
return false
end
end
end
end
end
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.
Thanks,
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)
SetTextFont(0)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(r, g, b, a)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x - width/2, y - height/2 + 0.005)
end
Citizen.CreateThread(function()
while true do
Wait(0)
if IsControlPressed(1, 217)then -- Caps Lock
if radar.shown then radar.shown = false else radar.shown = true end
Wait(75)
end
if IsControlPressed(1, 38)then -- E
if radar.freeze then radar.freeze = false else radar.freeze = true end
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) )
else
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) )
end
end
end
end
DrawRect(0.5,0.0,0.12,0.18,0,10,28,210)
drawTxt(0.53,0.1,0.185,0.206,0.40,radar.info,255,255,255,255)
end
end
end)
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