Squirrel/Server/Functions/Players/Health

From Liberty Unleashed Wiki
Revision as of 00:42, 27 July 2010 by Stoku (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This function sets/returns the players health.

Syntax

  1. float Player.Health( int Value )

Arguments

  • Value - What you can set the health value to.

Example 1. Returning

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd== "health" )
  5. {
  6. MessagePlayer( "Your health is " + player.Health + ".", player);
  7. }
  8. }
  9.  

This will tell the player what their health value currently is.

Example 2. Setting

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd== "heal" )
  5. {
  6. player.Health = 100;
  7. }
  8. }
  9.  

This will heal the player whenever they use /heal.

Notes

The call onPlayerCommand and MessagePlayer were used in in this example. More info about them in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox