Hmm… Wouldn’t it be better to use statebags? And maybe also use low-level game events such as CEventNetworkPlayerEnteredVehicle instead of the while true loops?
Definitely on the stage bags, did not think of that this time for some reason. I’m not particularly good at using state bags with entities so I could try to brush up on it and rework.
Using vehicle enter exit events are probably also a good idea to keep things stable and clean.
im not sure tbh would like to share it here tho to find out if what im useing is worth useing or if yours is more optimised. if its okay for me to share it
Citizen.CreateThread(function()
while true do
– Loop forever and update every frame
Citizen.Wait(0)
-- Get player and vehicle player is in
local player = GetPlayerPed(-1)
local vehicle = GetVehiclePedIsIn(player, false)
-- If player is in a vehicle and it's not moving
if (vehicle ~= nil) and (GetEntitySpeed(vehicle) <= 0.25) then
-- Set brake lights
SetVehicleBrakeLights(vehicle, true)
end
end
so i added yours to the server and client of my small resources folder and it was spamming my f8 menu slowly with GetNetworkobject: no object by ID 0. has there been a update or anything to fix this or has anyone else had this issue.?