Scripting/Squirrel/Events/Player/onPlayerHealthChange
From VC-MP Wiki
This is called when player's health amount changes.
Syntax
function onPlayerHealthChange( player, oldHealth, newHealth )
Parameters
- player - The pointer of the player
- oldHealth - The amount of health player had before the change
- newHealth - The current health amount
Example
This will tell the player if they got hurt.
function onPlayerHealthChange( player, oldhp, newhp ) { if ( oldhp > newhp ) MessagePlayer( "You just lost " + ( oldhp - newhp ) + " health.", player ); }
Notes
The function MessagePlayer was used in in this example. More info about it in the corresponding page.
Related Events
- onPlayerJoin
- onPlayerPart
- onPlayerCrashDump
- onPlayerSpawn
- onPlayerDeath
- onPlayerKill
- onPlayerTeamKill
- onPlayerChat
- onPlayerAction
- onPlayerPM
- onPlayerFailedPM
- onPlayerTeamChat
- onPlayerCommand
- onPlayerHealthChange
- onPlayerArmourChange
- onPlayerWeaponChange
- onPlayerCashChange
- onPlayerScoreChange
- onPlayerKeyStateChange
- onPlayerMove
- onPlayerRequestClass
- onPlayerRequestAmmunation
- onPlayerRequestAmmuWeapon
- onPlayerStartSpectating
- onPlayerExitSpectating
- onPlayerRconLogin
- onPlayerRconLoginAttempt
- onPlayerFall
- onPlayerVersion
