Squirrel/Server/Functions/SpawnClass/FindSpawnClass
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function finds a ''SpawnClass'' from an ID and returns the pointer. If no spawn class is found, ''null'' will be returned. == Syntax == <code>SpawnClass FindSpawnClass( in...) |
|||
Line 10: | Line 10: | ||
* '''id''' - The ID of the spawn class to be found | * '''id''' - The ID of the spawn class to be found | ||
− | |||
− | |||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | - | + | function onPlayerCommand( player, cmd, text ) |
+ | { | ||
+ | if ( cmd == "findclass" ) | ||
+ | { | ||
+ | if ( text ) p_SpawnClass <- FindSpawnClass( text.tointeger() ); | ||
+ | } | ||
+ | } | ||
</code> | </code> | ||
+ | |||
+ | This example will try and find a spawn class associated with the specified id. | ||
=== Notes === | === Notes === | ||
− | + | The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page. | |
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Functions/SpawnClass}} | {{Squirrel/Server/Functions/SpawnClass}} |
Revision as of 17:16, 8 March 2010
This function finds a SpawnClass from an ID and returns the pointer. If no spawn class is found, null will be returned.
Syntax
SpawnClass FindSpawnClass( int id )
Arguments
- id - The ID of the spawn class to be found
function onPlayerCommand( player, cmd, text ) { if ( cmd == "findclass" ) { if ( text ) p_SpawnClass <- FindSpawnClass( text.tointeger() ); } }
This example will try and find a spawn class associated with the specified id.
Notes
The call onPlayerCommand was used in in this example. More info about this in the corresponding page.