bindKey

From GTA Connected
Jump to navigation Jump to search

Function Server and Client All Games Online and Offline

Server 1.0.0, Client 1.0.0

void bindKey(int keyCode, int keyState, function callback)

Description

The bindKey function is used to bind a handler to be called when a specific key is pressed or released.

Parameters

Type Name Presence Default Value Description
int
keyCode
required n/a The key code to bind the event for.
int
keyState
required n/a The key state to bind the event for.
function
callback
required n/a The scripting fucntion to call when the event occurs.

Returns

Success Returns

Type Description
void
This function doesn't return any values on success.

Failure Returns

Type Value
void
n/a

Notes

Examples

Example 1 - JavaScript:

bindKey(SDLK_g, KEYSTATE_DOWN, function(e)
{
    console.log("g key pressed down.");
})

Compatibility

There isn't any compatibility information for this function.

Related

Server Related

bindKey
unbindAllKeys
unbindKey


Client Related

bindKey
isKeyDown
isScancodePressed
unbindAllKeys
unbindKey