Squirrel/Server/Events/Player/onPlayerKeyStateChange
From Liberty Unleashed Wiki
(Difference between revisions)
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|onPlayerKeyStateChange}} | |
+ | |||
This is called when a player presses or stops pressing a certain key. | This is called when a player presses or stops pressing a certain key. | ||
Line 23: | Line 24: | ||
function onPlayerKeyStateChange ( pPlayer, key, down ) { | function onPlayerKeyStateChange ( pPlayer, key, down ) { | ||
− | if ( ( key == KEY_ONFOOT_FIRE ) && ( down ) ) MessagePlayer( "You just pressed <FIRE>.", pPlayer ); | + | if ( ( key == KEY_ONFOOT_FIRE ) && ( down ) ) MessagePlayer ( "You just pressed <FIRE>.", pPlayer ); |
return; | return; |
Latest revision as of 16:55, 10 November 2013
This is called when a player presses or stops pressing a certain key.
[edit] Syntax
function onPlayerKeyStateChange ( player, key, pressedDown )
[edit] Arguments
- player - The pointer of the player
- key - The ID of the key in question
- pressedDown - A boolean representing whether the key was just pressed down or released
[edit] Returns
This event does not handle return values.
[edit] Example
The following example will annoy the player by noticing them every time they press the 'fire' key.
function onPlayerKeyStateChange ( pPlayer, key, down ) { if ( ( key == KEY_ONFOOT_FIRE ) && ( down ) ) MessagePlayer ( "You just pressed <FIRE>.", pPlayer ); return; }
[edit] Notes
The function MessagePlayer was used in in this example. More info about it in the corresponding page.
[edit] Related Events
- onPlayerAction
- onPlayerArmourChange
- onPlayerCashChange
- onPlayerChat
- onPlayerCommand
- onPlayerConnect
- onPlayerDeath
- onPlayerFall
- onPlayerHealthChange
- onPlayerIslandChange
- onPlayerJoin
- onPlayerKeyStateChange
- onPlayerKill
- onPlayerPart
- onPlayerScoreChange
- onPlayerSkinChange
- onPlayerSpawn
- onPlayerUpdate
- onPlayerTeamChange
- onPlayerUseDetonator
- onPlayerVirtualWorldChange
- onPlayerWeaponChange