- Documentation
- Shared functions
- unbindKey
Function
unbindKey
Unbinds a function or a command from a key. Without a function it removes everything from the key in that state, and without a state in both states.
Syntax
Server
bool unbindKey(player thePlayer, string key [, string keyState, function|string handler])Client
bool unbindKey(string key [, string keyState, function|string handler])Arguments
thePlayerplayer- The player (server only).
keystring- The key.
keyStatestring, optional"down","up"or"both".handlerfunction|string, optional- The function or command to unbind.
Returns
true if something was unbound.
Example
local function jump() outputChatBox("Hop!") end
bindKey("space", "down", jump)
setTimer(unbindKey, 10000, 1, "space", "down", jump)
See also
bindKeyBinds a function or a command to a player's key. The function gets (on the server also the player) the key name, the state and the extra arguments frombindKey. Instead of a function you can pass a command name: the key runs it like/command. On the server the player's game watches the key and reports presses to the server.isKeyBoundChecks whether a function is bound to a key (a specific one or any).