Player.Cash

From Liberty Unleashed Wiki
Jump to: navigation, search
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.

Syntax

  1. float Player.Cash( int Cash )

Arguments

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

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.

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.

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox