Player.Score

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

This function sets/returns the players score.

Syntax

  1. int player.Score
  1. player.Score = int value

Arguments

  • value - The score to set

Example 1. Returning

This will tell the player what score they have when they type '/score'

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "score" )
  5. {
  6. MessagePlayer( "Current score - " + pPlayer.Score, pPlayer );
  7. }
  8. return 1;
  9. }
  10.  

Example 2. Setting

This will set the player's score to '2' when they '/score2'.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "score" )
  5. {
  6. pPlayer.Score = 2;
  7. }
  8. return 1;
  9. }
  10.  

Notes

The function MessagePlayer and event onPlayerCommand were used in this example. More info about them in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox