Squirrel/Client/Events/Player/onClientCashChange

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Notes)
 
Line 1: Line 1:
 
{{Squirrel/Title|onClientCashChange}}
 
{{Squirrel/Title|onClientCashChange}}
This is called when the clients Cash changes.
+
This is called when the clients cash changes.
  
 
== Syntax ==
 
== Syntax ==
  
<code lang="squirrel">function onClientCashChange( int iOldCash, int iNewCash )</code>
+
<code>function onClientCashChange( int oldcash, int newcash )</code>
  
 
=== Arguments ===
 
=== Arguments ===
  
* '''iOldCash''' - The player's Old Cash Value
+
* '''oldcash''' - The player's old cash value
* '''iNewCash''' - The player's New Cash Value
+
* '''newcash''' - The player's new cash value
  
 
=== Returns ===
 
=== Returns ===
  
* '''1''' - No Effect
+
This event does not handle return values.
* '''0''' - No Effect
+
  
 
== Example ==
 
== Example ==
  
This example will Message the player when their cash changes
+
This example will message the player when their cash changes.
  
Create a Global for a player pointer.
 
<code lang="squirrel">pPlayer <- FindLocalPlayer();</code>
 
 
<code lang="squirrel">
 
<code lang="squirrel">
function onClientCashChange( iOldCash, iNewCash ) {
+
function onClientCashChange( oldcash, newcash )
MessagePlayer("You have: " + pPlayer.Cash, pPlayer );
+
{
return 1;
+
    Message( "You now have $" + newcash );
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
Line 32: Line 31:
  
  
The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and [[Squirrel/Server/Functions/Players/Cash|Player.Cash]] were used in this example. More info about them can be found in the corresponding pages.
+
The function [[Squirrel/Client/Functions/Messages/Message|Message]] was used in this example. More info about it can be found in the corresponding page.
  
 
== Related Events ==
 
== Related Events ==
  
 
{{Squirrel/Client/Events/Player}}
 
{{Squirrel/Client/Events/Player}}

Latest revision as of 19:08, 14 April 2011

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

This is called when the clients cash changes.

[edit] Syntax

  1. function onClientCashChange( int oldcash, int newcash )

[edit] Arguments

  • oldcash - The player's old cash value
  • newcash - The player's new cash value

[edit] Returns

This event does not handle return values.

[edit] Example

This example will message the player when their cash changes.

  1.  
  2. function onClientCashChange( oldcash, newcash )
  3. {
  4. Message( "You now have $" + newcash );
  5. return 1;
  6. }
  7.  

[edit] Notes

The function Message was used in this example. More info about it can be found in the corresponding page.

[edit] Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox