onClientKeyStateChange
From Liberty Unleashed Wiki
This event is called when the local player kills somebody else.
Syntax
function onClientKeyStateChange( oldkeys, newkeys )
Arguments
- oldkeys - The last known keys pressed by the player
- newkeys - The new key states
Returns
This event does not handle return values.
Example
The following example will kill the player when they shoot
function onClientKeyStateChange( oldKeys, newKeys ) { if ( newKeys & KEY_ONFOOT_FIRE ) { local plr = FindLocalPlayer(); // We dont want the player to shoot, so kill the sucker! Message( "You are not allowed to shoot here, so die!" ); plr.Health = 0; } }
Notes
The commands Message, FindLocalPlayer and Player.Health was used in in this example. More info about these in the corresponding pages.
Related Events
- onClientArmourChange
- onClientCashChange
- onClientCollideWithPlayer
- onClientCommand
- onClientDeath
- onClientFall
- onClientHealthChange
- onClientHurt
- onClientKill
- onClientKeyStateChange
- onClientRequestClass
- onClientRequestSpawn
- onClientShot
- onClientSpawn
- onClientUseDetonator
- onClientWeaponChange
- onPlayerDeath
- onPlayerJoin
- onPlayerKill
- onPlayerPart
- onPlayerSpawn