Squirrel/Server/Functions/Players/Class

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Notes)
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|Player.Class}}
 
This function sets/returns the players class.
 
This function sets/returns the players class.
  

Latest revision as of 10:31, 11 October 2010

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

This function sets/returns the players class.

[edit] Syntax

  1. float Player.Class( int Value )

[edit] Arguments

  • Value - What you can set the class to.

[edit] 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.

[edit] 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.

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox