Jump to content

[HELP] Cant correctly bind escape on client side


opnaiC

Recommended Posts

Hello guys,

I tried to bind escape to my function in 2 ways. (the function is working tried with other buttons) The first was bindKey but when I use it its not binding escape but all other buttons. When I use the event onClientKey escape is working but not correctly. When I press it the first time its working but when I press it the second time its not working. (so its not working when the player is in the menu) (btw its a AFK system I made)

this way is not working: 

bindKey ( "escape", "down", function )

this was isnt working  correctly (this is what I found on wiki: Note: the escape key can only be cancelled once. If a user presses the escape key twice in a row the main menu will still open. ):

function pressDown (button, press)
  if button == "escape" then
    if press then  -- when the button is pressed down (true)
      function()
    end
  end    
end
addEventHandler ("onClientKey", root, pressDown)

 

Guys I hope you can help me with that

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