From 1914d35408aaf2736f7164ad7871548d2f19929d Mon Sep 17 00:00:00 2001 From: Flohhhhh <48927090+Flohhhhh@users.noreply.github.com> Date: Fri, 8 Dec 2023 02:30:52 -0500 Subject: [PATCH] Fix entity doesn't exist error on join --- real-brake-lights/client.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/real-brake-lights/client.lua b/real-brake-lights/client.lua index 55ec8c0..4d4fd52 100644 --- a/real-brake-lights/client.lua +++ b/real-brake-lights/client.lua @@ -91,6 +91,7 @@ local function onEnteredVehicle(_vehicle) local brakeLights = false while true do + -- if i'm not in the vehicle turn off its brake lights and return if GetVehiclePedIsIn(ped, false) ~= vehicle then TriggerServerEvent("rbl:setParked", VehToNet(vehicle), true) @@ -98,6 +99,7 @@ local function onEnteredVehicle(_vehicle) end local speed = GetEntitySpeed(vehicle) * 2.236936 -- get speed in MPH + if vehicle == 0 then goto continue end -- if vehicle doesn't exist return if speed <= threshold and not IsControlPressed(0, 32) then -- if stopped if not brakeLights then -- if brake lights are not already on, turn them on and start a timer for park state --print("Enabling for my vehicle") @@ -121,6 +123,7 @@ local function onEnteredVehicle(_vehicle) end end + ::continue:: Wait(250) end end)