Squirrel/Server/Functions/Players/Class

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function sets/returns the players class. == Syntax == <code>float Player.Class( int Value )</code> == Arguments == * '''Value''' - What you can set the class to. == Exa...)
 
(Notes)
Line 41: Line 41:
 
=== Notes ===
 
=== Notes ===
  
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] were used in in this example. More info about them in the corresponding page.
+
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] and [[Squirrel/Server/Functions/Messages/MessagePlayer|MessagePlayer]] were used in in this example. More info about them in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Server/Functions/Players}}
 
{{Squirrel/Server/Functions/Players}}

Revision as of 02:41, 26 May 2010

This function sets/returns the players class.

Syntax

  1. float Player.Class( int Value )

Arguments

  • Value - What you can set the class to.

Example 1. Returning

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "class" )
  5. {
  6. MessagePlayer( "Your class is " + pPlayer.Class + ".", pPlayer );
  7. }
  8. }
  9.  

This will tell the player what their class currently is.

Example 2. Setting

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "newclass" )
  5. {
  6. pPlayer.Class = 10;
  7. }
  8. }
  9.  

This will set the players class to 10 when they do /newclass.

Notes

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

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox