bindKey

From GTA Connected
Revision as of 14:44, 15 February 2020 by Mex (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Server and Client icon-iii.png icon-vc.png icon-sa.png icon-iv.png Online and Offline

Available since Server 1.0.0, Client 1.0.0

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

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

Parameters

1) int keyCode The key code to bind the event for.
2) int keyState The key state to bind the event for.
3) function callback The scripting fucntion to call when the event occurs.

Return

void This function doesn't return a value.

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

icon-iii.png icon-vc.png icon-sa.png icon-iv.png bindKey
icon-iii.png icon-vc.png icon-sa.png icon-iv.png unbindAllKeys
icon-iii.png icon-vc.png icon-sa.png icon-iv.png unbindKey


Client Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png bindKey
icon-iii.png icon-vc.png icon-sa.png icon-iv.png isKeyDown
icon-iii.png icon-vc.png icon-sa.png icon-iv.png isScancodePressed
icon-iii.png icon-vc.png icon-sa.png icon-iv.png unbindAllKeys
icon-iii.png icon-vc.png icon-sa.png icon-iv.png unbindKey