ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. unbindKey

Function

unbindKey

Server and clientInput and controlsIdentical to MTA:SA

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