I’m trying to create client side scripting based on js, but i found a problem of the tick system. Basically if i’m using setTick method it will not run on every frame. I started to debugging the problem and i saw 30-50 frame ( based on the Citizen.getTickCount() ) skipping each setTick callback. This could be a problem if you want to call a native function each tick (like disable traffic related functions).
Huh? This function returns milliseconds, not ‘frames’ (and it should not exist, probably a leftover from an early scheduling iteration, since now GetGameTimer exists).
Do you have a repro of whatever not running every frame?
The javascript method don’t disable fully the traffic. The traffic is reduced but not fully disabled. The best example for this are using SetAmbientVehicleRangeMultiplierThisFrame(0.0); which creates ghost cars ( cars popping out and disappearing in a second ).
I try to do a workaround by creating a simple event trigger in lua which is running on that loop and just triggering the javascript code piece but the result was the same.
I confirm the bug, I have the same problem. Anyone has an idea for fixing this bug?
I don’t think it’s due to setTick, the following code result in the same bug :
client.lua
Citizen.CreateThread(function()
while true do
TriggerEvent("test")
Wait(0)
end
end)