isKeyBound | Multi Theft Auto: Wiki Skip to content

isKeyBound

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function can be used to find out if a key has already been bound. If you do not specify a keyState or handler, any instances of key being bound will cause isKeyBound to return true.

Syntax

bool isKeyBound ( player thePlayer, string key, string keyState, function handler )
Required Arguments
  • thePlayer: The player you're checking.
  • key: The key you're checking. See Key names for a list of valid key names.
  • keyState: Is the state of the key when it calls the function, Can be either: "up": when the key is released "down": when the key is pressed
  • handler: The function you're checking against

Returns

  • bool: value

Returns true if the key is bound, false otherwise.

Code Examples

shared
-- This function tells everyone in the server if someone has numpad 9 bound!
function onPlayerJoin ()
if (isKeyBound (source,"num_9")) then -- if num pad 9 is bound
outputChatBox (getPlayerName (source) .. " has bound numpad 9!",getRootElement(),255,0,0,false) -- let see everybody that he has binded it
end
end
addEventHandler ("onPlayerJoin",getRootElement(),onPlayerJoin) -- add event.