We are trying to implement and use [Release] Speedcamera
It is currently set to L and E but we would like to us U and I instead, but for some reason I am having the hardest time finding those keycodes, any help?
local radar = {shown = false, freeze = false, info = "none", minSpeed = 10.0, maxSpeed = 200.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, 7)then -- L
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 = GetCurrentTargetCar()
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)
function GetCurrentTargetCar()
local ped = GetPlayerPed(-1)
local coords = GetEntityCoords(ped)
local entityWorld = GetOffsetFromEntityInWorldCoords(ped, 0.0, 120.0, 0.0)
local rayHandle = CastRayPointToPoint(coords.x, coords.y, coords.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, ped, 0)
local a, b, c, d, vehicleHandle = GetRaycastResult(rayHandle)
return vehicleHandle
end