Squirrel/Server/Functions/SpawnClass/RemoveWeapon
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function removes the spawn weapon from the given slot of a ''SpawnClass''. == Syntax == <code>int SpawnClass.RemoveWeapon( int iSlot )</code> == Arguments == * '''iSlot''...) |
(→Example) |
||
Line 11: | Line 11: | ||
== Example == | == Example == | ||
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | function onPlayerCommand( player, cmd, text ) | |
+ | { | ||
+ | if ( cmd == "remwep" ) | ||
+ | { | ||
+ | if ( text ) p_SpawnClass.RemoveWeapon( 1 ); | ||
+ | } | ||
+ | } | ||
</code> | </code> | ||
+ | |||
+ | This example will remove the weapon in slot 1, from the class, that we created earlier in [[Squirrel/Server/Functions/SpawnClass/FindSpawnClass|FindSpawnClass]]. | ||
=== 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:45, 8 March 2010
This function removes the spawn weapon from the given slot of a SpawnClass.
Syntax
int SpawnClass.RemoveWeapon( int iSlot )
Arguments
- iSlot - The slot you want to remove the weapon from. There are three slots available: 1, 2 and 3
Example
function onPlayerCommand( player, cmd, text ) { if ( cmd == "remwep" ) { if ( text ) p_SpawnClass.RemoveWeapon( 1 ); } }
This example will remove the weapon in slot 1, from the class, that we created earlier in FindSpawnClass.
Notes
The call onPlayerCommand was used in in this example. More info about this in the corresponding page.