saluta Posted June 27, 2021 Share Posted June 27, 2021 Spoiler function speed ( ) addEventHandler ( "onClientRender", root, getspeed ) end addEventHandler ("onClientVehicleEnter", root, speed) Spoiler Link to comment
βurak Posted June 27, 2021 Share Posted June 27, 2021 you can check it with a variable local isAdded = false function speed() if(isAdded == false) then addEventHandler ("onClientRender", root, getspeed) isAdded = true end end addEventHandler("onClientVehicleEnter", root, speed) Link to comment
Other Languages Moderators androksi Posted June 27, 2021 Other Languages Moderators Share Posted June 27, 2021 Hello. It would be good if you also use onClientVehicleExit, to remove the eventHandler; then that error won't probably happen. Example: addEventHandler("onClientVehicleEnter", root, function(player, seat) --[[ We should check here if the player who entered the vehicle is the localPlayer, otherwise the addEventHandler would be called for everyone Also, we need to check if the seat is 0 (driver), otherwise passengers would execute the function ]] if player == localPlayer and seat == 0 then addEventHandler("onClientRender", root, getspeed) end end) addEventHandler("onClientVehicleExit", root, function(player, seat) if player == localPlayer and seat == 0 then removeEventHandler("onClientRender", root, getspeed) end end) Link to comment
saluta Posted June 28, 2021 Author Share Posted June 28, 2021 15 часов назад Burak5312 сказал: вы можете проверить это с помощью модели Т 15 hours ago, Burak5312 said: вы можете проверить это с помощью переменной Thanks very much. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now