Squirrel/Server/Functions/SpawnClass/AddSpawnClass
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|AddSpawnClass}} This function adds a new spawnclass to the game. Used in the spawnscreen == Syntax == <code>SpawnClass AddSpawnClass( int skin, int team, Vecto…') |
|||
Line 17: | Line 17: | ||
== Example == | == Example == | ||
− | + | This will add a new class to the spawn screen the next time it is visited for each player when '/addclass' is typed. | |
− | + | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerCommand( pPlayer, szCommand, szText ) | |
+ | { | ||
+ | if ( szCommand == "addclass" ) | ||
+ | { | ||
+ | AddSpawnClass( 100, 1, pPlayer.Pos, pPlayer.Angle, 1, 0 ); | ||
+ | } | ||
+ | |||
+ | return 1; | ||
+ | } | ||
</code> | </code> | ||
=== Notes === | === Notes === | ||
− | + | The event [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in this example. More info about this in the corresponding page. | |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/SpawnClass}} | {{Squirrel/Server/Functions/SpawnClass}} |
Latest revision as of 17:49, 25 October 2010
This function adds a new spawnclass to the game. Used in the spawnscreen
[edit] Syntax
SpawnClass AddSpawnClass( int skin, int team, Vector pos, float angle, int col, int spawnscreen )
[edit] Arguments
- skin - The skin ID to spawn as
- team - The team ID of the spawn
- pos - The location the class will spawn at
- angle - The angle the spawn will be facing when spawned
- col - The spawns colour, used in the nickname and radar blip
- spawnscreen - The spawn screen to use.
[edit] Example
This will add a new class to the spawn screen the next time it is visited for each player when '/addclass' is typed.
function onPlayerCommand( pPlayer, szCommand, szText ) { if ( szCommand == "addclass" ) { AddSpawnClass( 100, 1, pPlayer.Pos, pPlayer.Angle, 1, 0 ); } return 1; }
[edit] Notes
The event onPlayerCommand was used in this example. More info about this in the corresponding page.