Squirrel/Client/Events/Player/onClientArmourChange

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|onClientArmourChange}} This is called when the clients Armour changes. == Syntax == <code lang="squirrel">function onClientArmourChange( int iOldArmour, int iN…')
 
(Fixed example)
Line 1: Line 1:
 
{{Squirrel/Title|onClientArmourChange}}
 
{{Squirrel/Title|onClientArmourChange}}
This is called when the clients Armour changes.
+
This is called when the clients armour changes.
  
 
== Syntax ==
 
== Syntax ==
  
<code lang="squirrel">function onClientArmourChange( int iOldArmour, int iNewArmour )</code>
+
<code>function onClientArmourChange( int iOldArmour, int iNewArmour )</code>
  
 
=== Arguments ===
 
=== Arguments ===
Line 13: Line 13:
 
=== Returns ===
 
=== Returns ===
  
* '''1''' - No Effect
+
This event does not handle return values.
* '''0''' - No Effect
+
  
 
== Example ==
 
== Example ==
Line 20: Line 19:
 
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 onClientArmourChange( iOldArmour, iNewArmour ) {
+
function onClientArmourChange( iOldArmour, iNewArmour )
MessagePlayer("You have: " + pPlayer.Armour + "Armour remaining", pPlayer );
+
{
return 1;
+
    Message( "You have: " + pPlayer.Armour + " Armour remaining" );
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>
Line 32: Line 31:
  
  
The functions [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] and [[Squirrel/Server/Functions/Players/Armour|Player.Armour]] were used in this example. More info about them can be found in the corresponding pages.
+
The functions [[Squirrel/Client/Functions/Messages/Message|Message]] and [[Squirrel/Client/Functions/Players/Armour|Player.Armour]] were used in this example. More info about them can be found in the corresponding pages.
 +
 
 
== Related Events ==
 
== Related Events ==
  
 
{{Squirrel/Client/Events/Player}}
 
{{Squirrel/Client/Events/Player}}

Revision as of 18:54, 14 April 2011

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

This is called when the clients armour changes.

Syntax

  1. function onClientArmourChange( int iOldArmour, int iNewArmour )

Arguments

  • iOldArmour - The player's Old Armour Value
  • iNewArmour - The player's New Armour Value

Returns

This event does not handle return values.

Example

This example will Message the player when their cash changes

  1.  
  2. function onClientArmourChange( iOldArmour, iNewArmour )
  3. {
  4. Message( "You have: " + pPlayer.Armour + " Armour remaining" );
  5. return 1;
  6. }
  7.  

Notes

The functions Message and Player.Armour were used in this example. More info about them can be found in the corresponding pages.

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox