UnbindKey

From Multi Theft Auto: Wiki
Revision as of 17:27, 26 June 2006 by MrJax (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Removes an existing key bind from the specified player. Note: will remove all the binds from the current key if no command is specified

Syntax

unbindKey ( player thePlayer, string key, [string command] ) 

Required Arguments

  • thePlayer: The player you wish to unbind the key of.
  • key: The key you wish to unbind.

Optional Arguments

  • command: The command you wish to unbind.

Example

This function will bind a player's 'F1' key to a command, then remove it after it's been used.

addCommandHandler ( "bindmekeysplz", "bindtehkeys" )
function bindtehkeys ( )
  bindKey ( source, "F1", "moo" ) -- bind the player's F1 key
end

addCommandHandler ( "moo", "moo" )
function moo ( )
  outputChatBox ( getClientName ( source ).." says Mooooooo!" )
  unbindKey ( source, "F1", "moo" ) -- this function will no longer be triggered by the player, after removing the bind.
end

See Also

Template:Key functions