Squirrel/Client/Events/Player/onClientCashChange
From Liberty Unleashed Wiki
(Difference between revisions)
Line 1: | Line 1: | ||
− | {{Squirrel/Title| | + | {{Squirrel/Title|onClientCashChange}} |
This is called when the clients Cash changes. | This is called when the clients Cash changes. | ||
== Syntax == | == Syntax == | ||
− | <code>function onClientCashChange( int iOldCash, int iNewCash )</code> | + | <code lang="squirrel">function onClientCashChange( int iOldCash, int iNewCash )</code> |
=== Arguments === | === Arguments === | ||
Line 21: | Line 21: | ||
Create a Global for a player pointer. | Create a Global for a player pointer. | ||
− | <code>pPlayer <- FindLocalPlayer();</code> | + | <code lang="squirrel">pPlayer <- FindLocalPlayer();</code> |
− | <code> | + | <code lang="squirrel"> |
function onClientCashChange( iOldCash, iNewCash ) { | function onClientCashChange( iOldCash, iNewCash ) { | ||
MessagePlayer("You have: " + pPlayer.Cash, pPlayer ); | MessagePlayer("You have: " + pPlayer.Cash, pPlayer ); |
Revision as of 19:03, 11 April 2011
This is called when the clients Cash changes.
Syntax
function onClientCashChange( int iOldCash, int iNewCash )
Arguments
- iOldCash - The player's Old Cash Value
- iNewCash - The player's New Cash Value
Returns
- 1 - No Effect
- 0 - No Effect
Example
This example will Message the player when their cash changes
Create a Global for a player pointer.
pPlayer <- FindLocalPlayer();
function onClientCashChange( iOldCash, iNewCash ) { MessagePlayer("You have: " + pPlayer.Cash, pPlayer ); return 1; }
Notes
The functions MessagePlayer and Player.Cash were used in this example. More info about them can be found in the corresponding pages.