onPlayerHealthChange

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This is called when a player's health changes.

Syntax

  1. function onPlayerHealthChange( Player player, int oldHealth, int newHealth )

Arguments

  • player - The pointer of the player
  • oldHealth - The amount of health player had before the change
  • newHealth - The current health amount

Returns

This event does not handle return values.

Example

This will tell the player if they have lost hp.

  1.  
  2. function onPlayerHealthChange( player, oldhp, newhp )
  3. {
  4. if ( oldhp > newhp ) MessagePlayer( "You lost " + ( oldhp - newhp ) + " hp", player );
  5. return 1;
  6. }
  7.  

Notes

The function MessagePlayer was used in this example. More info about it can be found in the corresponding page.

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox