Squirrel/Server/Functions/Players/Health

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
 
Line 4: Line 4:
 
== Syntax ==
 
== Syntax ==
  
<code>float Player.Health( int Value )</code>
+
<code>float player.Health</code>
 +
<code>player.Health = float value</code>
  
 
== Arguments ==
 
== Arguments ==
  
* '''Value''' - What you can set the health value to.
+
* '''value''' - What you can set the health value to.
  
 
== Example 1. Returning ==
 
== Example 1. Returning ==

Latest revision as of 11:45, 15 October 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function sets/returns the players health.

[edit] Syntax

  1. float player.Health
  1. player.Health = float value

[edit] Arguments

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

[edit] 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.

[edit] 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.

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox