Jump to content

Bad usage @'addEventHandler'


saluta

Recommended Posts

  • Other Languages Moderators

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
15 часов назад Burak5312 сказал:

вы можете проверить это с помощью модели


 


	   
    

 

Т

15 hours ago, Burak5312 said:

вы можете проверить это с помощью переменной


 


	   
    

 

Thanks very much.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...