Squirrel/Server/Functions/SpawnClass/Team

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Example 2. Setting)
 
Line 1: Line 1:
__NOTOC__
+
{{Squirrel/Title|SpawnClass.Team}}
 
This ''SpawnClass'' class member returns or sets the team ID for the given spawn class. If you want to use deathmatch teams set the team ID to INVALID_TEAM_ID (255).
 
This ''SpawnClass'' class member returns or sets the team ID for the given spawn class. If you want to use deathmatch teams set the team ID to INVALID_TEAM_ID (255).
  

Latest revision as of 10:39, 11 October 2010

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

This SpawnClass class member returns or sets the team ID for the given spawn class. If you want to use deathmatch teams set the team ID to INVALID_TEAM_ID (255).

[edit] Syntax

You can either return or set a new value using this member:

  1. int SpawnClass.Team
  1. SpawnClass.Team = int team

[edit] Arguments

  • team - The new team ID for the spawn class

[edit] Example 1. Returning

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "getteam" )
  5. {
  6. local team = p_SpawnClass.Team;
  7. MessagePlayer( "The current spawn class team is: " + team, player );
  8. }
  9. }
  10.  

This example will return the team of the spawn class, that we found earlier in FindSpawnClass.

[edit] Example 2. Setting

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "setteam" )
  5. {
  6. local team;
  7. if ( text ) team = text.tointeger();
  8. if ( team ) p_SpawnClass.Team = team;
  9. }
  10. }
  11.  

This example will set the team of the spawn class, that we found earlier in FindSpawnClass.

[edit] Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox