Jump to content

removeCommandHandler


callum123

Recommended Posts

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) 

Link to comment

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 ) 

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...