Squirrel/Server/Functions/SpawnClass/AddSpawnClass

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(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 ==
  
{{Squirrel/NeedsExample}}
+
This will add a new class to the spawn screen the next time it is visited for each player when '/addclass' is typed.
Explanation for the example
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- Todo
+
function onPlayerCommand( pPlayer, szCommand, szText )
 +
{
 +
if ( szCommand == "addclass" )
 +
{
 +
AddSpawnClass( 100, 1, pPlayer.Pos, pPlayer.Angle, 1, 0 );
 +
}
 +
 +
return 1;
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
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

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

This function adds a new spawnclass to the game. Used in the spawnscreen

[edit] Syntax

  1. 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.

  1.  
  2. function onPlayerCommand( pPlayer, szCommand, szText )
  3. {
  4. if ( szCommand == "addclass" )
  5. {
  6. AddSpawnClass( 100, 1, pPlayer.Pos, pPlayer.Angle, 1, 0 );
  7. }
  8. return 1;
  9. }
  10.  

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox