Hey guys been trying to use spotlights as headlights so i can use blackout too i tried to put it on a button press like the headlights “h” but wheni press H to turn on the spot lights they just flash white (the 255,255,255 one) i have tried a few things that just made it stop and had someone else look and had the same result i am new at this so probably not the best but could anyone help keep the light on but want it as a toggle so can be switched off
client.lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
vehicle = GetVehiclePedIsUsing(GetPlayerPed(-1))
anycarX, anycarY, anycarZ = table.unpack(GetEntityCoords(vehicle, true))
dirX, dirY, dirZ = table.unpack(GetEntityForwardVector(vehicle))
if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
if IsControlJustPressed(1, 74) then
if DrawSpotLight(anycarX, anycarY, anycarZ, dirX, dirY, dirZ, 255, 255, 255, 125.0, 1.0, 1.0, 20.0, 0.95) then
DrawSpotLight(anycarX, anycarY, anycarZ, dirX, dirY, dirZ, 0, 0, 0, 125.0, 0, 1.0, 0, 0.95)
end
end
end
end
end)`
Citizen.CreateThread(function()
local bool = false
while true do
Citizen.Wait(0)
local anycarX, anycarY, anycarZ = table.unpack(GetEntityCoords(GetVehiclePedIsUsing(GetPlayerPed(-1)), true))
local dirX, dirY, dirZ = table.unpack(GetEntityForwardVector(GetVehiclePedIsUsing(GetPlayerPed(-1))))
if IsPedSittingInAnyVehicle(GetPlayerPed(-1)) then
if IsControlJustPressed(1, 74) then
bool = not bool
end
if bool then
DrawSpotLight(anycarX, anycarY, anycarZ, dirX, dirY, dirZ, 255, 255, 255, 125.0, 1.0, 1.0, 20.0, 0.95)
end
else
bool = false
end
end
end)