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

Function

isKeyBound

Server and clientInput and controlsIdentical to MTA:SA

Checks whether a function is bound to a key (a specific one or any).

Syntax

Server

bool isKeyBound(player thePlayer, string key [, string keyState, function handler])

Client

bool isKeyBound(string key [, string keyState, function handler])

Arguments

thePlayerplayer
The player (server only).
keystring
The key.
keyStatestring, optional
"down", "up" or "both".
handlerfunction, optional
A specific function.

Returns

true if something is bound.

Example

if not isKeyBound("F3") then
    bindKey("F3", "down", function() outputChatBox("F3") end)
end

See also