Scripting/Server/Events/onPlayerKeyStateChange

key is a KEY_ONFOOT_* or KEY_INCAR_* bit mask and down is true on press, false on release. The two groups overlap numerically (for example 4 is KEY_ONFOOT_FIRE and KEY_INCAR_FIRE), so check player.Vehicle to know which applies.

Syntax

onPlayerKeyStateChange(player, key, down)

Arguments

Example

function onPlayerKeyStateChange( player, key, down )
{
	// jump key pressed while on foot
	if ( down && ( key & KEY_ONFOOT_JUMP ) && !player.Vehicle )
		MessagePlayer( "You jumped.", player );
}

Section: Input and sync

Categories: Server events | Input and sync