callum123 Posted November 4, 2012 Posted November 4, 2012 is it possible to execute this command for the person who called it only?
Castillo Posted November 4, 2012 Posted November 4, 2012 No if it's used server side. You could make a table though, store there who "removed" the command, then when they try to use it, cancel the function.
callum123 Posted November 4, 2012 Author Posted November 4, 2012 I'm using it client side, heres what I was doing function bindthemkeys() setTimer ( function() addCommandHandler("bb", applybb) end, 2000, 1 ) end addEventHandler( "onClientVehicleEnter", getRootElement() , bindthemkeys) function unbindthemkeys() removeCommandHandler("bb") end addEventHandler( "onClientVehicleExit", getRootElement() , unbindthemkeys)
Castillo Posted November 4, 2012 Posted November 4, 2012 You have to check if the player that enter/exit is the local player. function bindthemkeys ( thePlayer ) if ( thePlayer == localPlayer ) then setTimer ( addCommandHandler, 2000, 1, "bb", applybb ) end end addEventHandler ( "onClientVehicleEnter", getRootElement() , bindthemkeys ) function unbindthemkeys ( thePlayer ) if ( thePlayer == localPlayer ) then removeCommandHandler ( "bb" ) end end addEventHandler ( "onClientVehicleExit", getRootElement() , unbindthemkeys )
callum123 Posted November 4, 2012 Author Posted November 4, 2012 Alright, thanks for your quick help! I did try something like that, but without the check! Thanks for helping me learn!
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