Squirrel/Client/Functions/Players/Cash

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|Player.Cash}} This function sets/returns a given player's cash. Setting the amount of cash only affects the local player. == Syntax == <code>float Player.Cash(…')
 

Latest revision as of 04:30, 24 September 2011

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

This function sets/returns a given player's cash. Setting the amount of cash only affects the local player.

[edit] Syntax

  1. float Player.Cash( int Cash )

[edit] Arguments

  • Cash - What you can set the player's cash to.

[edit] Example 1. Returning

  1.  
  2. function onClientCommand( szCommand, szText )
  3. {
  4. local pPlayer = FindLocalPlayer( );
  5. if ( szCommand == "cash" )
  6. Message( "You have $" + pPlayer.Cash + "." );
  7. }
  8.  

This will tell the local player what their cash balance currently is.

[edit] Example 2. Setting

  1.  
  2. function onClientCommand( szCommand, szText )
  3. {
  4. local pPlayer = FindLocalPlayer( );
  5. if ( szCommand == "moremoney" )
  6. pPlayer.Cash += 500;
  7. }
  8.  

This will give the local player $500 more when they use the command /moremoney.

[edit] Notes

The call onClientCommand and Message 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