Squirrel/Server/Functions/Players/Cash

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Notes)
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|Player.Cash}}
 
This function sets/returns the players cash.
 
This function sets/returns the players cash.
  

Latest revision as of 10:31, 11 October 2010

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

This function sets/returns the players cash.

[edit] Syntax

  1. float Player.Cash( int Value )

[edit] Arguments

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

[edit] Example 1. Returning

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "cash" )
  5. {
  6. MessagePlayer( "Your cash is " + pPlayer.Cash + ".", pPlayer );
  7. }
  8. }
  9.  

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

[edit] Example 2. Setting

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "gimmecash" )
  5. {
  6. pPlayer.Cash += 10000;
  7. }
  8. }
  9.  

This will give the player $10,000 whenever they use /gimmecash.

[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