Jump to content

cancel bind


#RooTs

Recommended Posts

@KariiiM, nothing happens. :lol::lol::lol:

addEventHandler("onClientKey", root, 
function ( key, press ) 
    if (key == "w") then 
        if (getKeyState("space")) then 
        cancelEvent() 
        outputChatBox ( "test" ) 
        end 
    end 
end) 

Link to comment
Rly men, just do like you did toggleControl it will work...

my attempt was this. but it did not work

function test(thePlayer, command) 
toggleControl("sprint", false) 
outputChatBox ( "test1" ) 
end 
  
addCommandHandler ( "test", test ) 

Link to comment

Try this @Root:

addEventHandler ( "onClientKey", getRootElement(), 
function (button, press) 
    if (button == "w") then 
        setElementData (getLocalPlayer(), "w", press) 
    else  
        return false 
    end 
    if (button == "space" and press) then 
        if (getElementData (getLocalPlayer(), "w")) then 
            cancelEvent() --cancel the event 
        end 
    end 
end) 

Link to comment

@KariiiM, not work.

maybe with??:

toggleControl("sprint", false) 

addEventHandler ( "onClientKey", getRootElement(), 
function (button, press) 
    if (button == "w") then 
        setElementData (getLocalPlayer(), "w", press) 
    else 
        return false 
    end 
    if (button == "space" and press) then 
        if (getElementData (getLocalPlayer(), "w")) then 
            toggleControl("sprint", false) 
        end 
    end 
end) 

but it also did not work :cry::cry:

Link to comment
Rly men, just do like you did toggleControl it will work...

my attempt was this. but it did not work

function test(thePlayer, command) 
toggleControl("sprint", false) 
outputChatBox ( "test1" ) 
end 
  
addCommandHandler ( "test", test ) 

sprint is running, it will only stop running, but if u want to stop walk u can use theese.

  
toggleControl("forwards", false) 
toggleControl("backwards", false) 
toggleControl("left", false) 
toggleControl("right", false) 
  

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