Drakath Posted May 5, 2014 Share Posted May 5, 2014 function speed (player) if player == localPlayer then addEventHandler ( "onClientRender", root, draw ) end end addEventHandler ("onClientVehicleEnter", root, speed) function hideSpeed (player) if player == localPlayer then removeEventHandler ( "onClientRender", root, draw ) end end addEventHandler("onClientVehicleExit", root, hideSpeed) Sometimes it outputs: "addEventHandler: 'onClientRender' with this function is already handled". Why? Link to comment
Karuzo Posted May 5, 2014 Share Posted May 5, 2014 Use a variable to define that the eventhandler was added and then just check it Link to comment
tosfera Posted May 5, 2014 Share Posted May 5, 2014 It should only do that whenever your vehicle has been destroyed by a command, restarting a resource or with the default admin panel. If that's the case, the 'onClientVehicleExit' wont be triggered. You can solve it on another way if you like that; function speed ( player ) if ( player == localPlayer ) then removeEventHandler ( "onClientRender", root, draw ) addEventHandler ( "onClientRender", root, draw ) end end addEventHandler ( "onClientVehicleEnter", root, speed ) Use a variable to define that the eventhandler was added and then just check it or do that. 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