GetSlotFromWeapon: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
===Returns=== | ===Returns=== | ||
*Returns the | *Returns an integer representing the given weapon ID's associated weapon slot, false if invalid. | ||
==Example== | ==Example== |
Revision as of 06:29, 4 August 2007
This allows you to identify the weapon slot that a weapon belongs to.
Syntax
int getSlotFromWeapon ( int weaponid )
Required Arguments
- weaponid: Specify the weapon of which weapon slot you want to know.
Returns
- Returns an integer representing the given weapon ID's associated weapon slot, false if invalid.
Example
This will output to the chatbox what weapon slot a given weapon number belongs to when entered into the console (ie. 'getWeaponSlot 10').
function outputWeaponSlot ( source, commandName, weaponID ) local weaponSlot = getSlotFromWeapon ( weaponID ) if (weaponSlot) then outputChatBox ( "Weapon ID " .. weaponID .. " is in weapon slot " .. weaponSlot) else outputChatBox ( "Invalid weapon ID" ) end end addCommandHandler ( "getWeaponSlot", outputWeaponSlot )
See Also
- getWeaponProperty
- getPickupWeapon
- getOriginalWeaponProperty
- getSlotFromWeapon
- getWeaponIDFromName
- getWeaponNameFromID
- setWeaponAmmo
- setWeaponProperty