Squirrel/Server/Functions/SpawnClass/Team
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example 2. Setting) |
|||
Line 1: | Line 1: | ||
− | + | {{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
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:
int SpawnClass.Team
SpawnClass.Team = int team
[edit] Arguments
- team - The new team ID for the spawn class
[edit] Example 1. Returning
function onPlayerCommand( player, cmd, text ) { if ( cmd == "getteam" ) { local team = p_SpawnClass.Team; MessagePlayer( "The current spawn class team is: " + team, player ); } }
This example will return the team of the spawn class, that we found earlier in FindSpawnClass.
[edit] Example 2. Setting
function onPlayerCommand( player, cmd, text ) { if ( cmd == "setteam" ) { local team; if ( text ) team = text.tointeger(); if ( team ) p_SpawnClass.Team = team; } }
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.