Scripting/Client/Events/onClientKeyStateChange
The controls of the local player changed. oldKeys / newKeys are bit masks of the same KEY_ONFOOT_* / KEY_INCAR_* values as the server event onPlayerKeyStateChange (FIRE, JUMP, SPRINT, FORWARD, ... on foot; HORN, HANDBRAKE, LOOKLEFT ... in a car), so a script can react to a key on the fly: if (newKeys & KEY_ONFOOT_FIRE) ... The first frame and a switch between on foot and in a car only set the baseline. PC and Android.
Syntax
onClientKeyStateChange(oldKeys, newKeys)Arguments
- any oldKeys
- any newKeys
Example
function onClientKeyStateChange( oldKeys, newKeys )
{
Message( "onClientKeyStateChange fired" );
}This sample was generated from the signature – adapt the values to your gamemode.
Related pages
- onScriptLoad
- onScriptUnload
- onClientSpawn
- onClientRender
- onClientCommand
- onClientMouseMove
- onClientMouseClick
- onClientMouseWheel
- onGameWindowResize
- onObjectShot
Section: Client events
Categories: Client events | Client events