Squirrel/Server/Functions/Players/Armour

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Related Functions)
(Example)
Line 11: Line 11:
 
== Example ==
 
== Example ==
  
This command gives player's armour when someone types '/c armour playername'.  
+
This command gives player's armour when someone types '/armour playername'.  
  
 
<code lang="squirrel">
 
<code lang="squirrel">

Revision as of 02:40, 26 May 2010

This function returns the current amount of armour on a player

Syntax

  1. int player.Armour
  2.  
  3. player.Armour = newArmour


Example

This command gives player's armour when someone types '/armour playername'.

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "armour" )
  5. {
  6. local plr = FindPlayer( text );
  7. if ( !plr ) MessagePlayer( "Error: Player '" + text + "' is not in the server.", player );
  8. else MessagePlayer( plr.Name + "'s armour: " + plr.Armour, player );
  9. }
  10. }
  11.  

Notes

The functions MessagePlayer, FindPlayer, player.Name and event call onPlayerCommand were used in in this example. More info about them can be found in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox