Squirrel/Server/Functions/SpawnClass/GetWeapon
From Liberty Unleashed Wiki
(Difference between revisions)
(→Example) |
|||
Line 1: | Line 1: | ||
− | + | {{Squirrel/Title|SpawnClass.GetWeapon}} | |
This function returns the spawn weapon ID in the given slot for a ''SpawnClass''. | This function returns the spawn weapon ID in the given slot for a ''SpawnClass''. | ||
Latest revision as of 10:38, 11 October 2010
This function returns the spawn weapon ID in the given slot for a SpawnClass.
[edit] Syntax
int SpawnClass.GetWeapon( int iSlot )
[edit] Arguments
- iSlot - The slot you want to retrieve the weapon info for. There are three slots available: 1, 2 and 3
[edit] Example
function onPlayerCommand( player, cmd, text ) { if ( cmd == "getwep" ) { local wep = p_SpawnClass.GetWeapon( 1 ); MessagePlayer( "The current wep in slot one is: " + wep, player ); } }
This example will return the weapon in slot 1 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.