GetSlotFromWeapon
Jump to navigation
Jump to search
This allows you to identify the weapon slot that a weapon belongs to
Syntax
int getSlotFromWeapon ( int weaponid )
Required Arguments
- weaponid: Specify the weapon whose weapon slot you want to know
Returns
- Returns the player's current weapon slot ID
- Returns false if it fails to retrieve current weapon slot
Example
This will output to the chatbox what weapon slot a player is using when the player switches weapons
addEventHandler ( "onPlayerWeaponSwitch", root, "PlayerWeaponSwitched" ) function PlayerWeaponSwitched ( previousWeaponID, currentWeaponID ) currentslot = getSlotFromWeapon ( currentWeaponID ) --Make the varible equal the current weapon slot. The current weapon slot was stored by the event outputChatBox ( "You switched to weapon slot "..currentslot ) --Output what weapon slot the player is now using end
See Also
- getWeaponProperty
- getPickupWeapon
- getOriginalWeaponProperty
- getSlotFromWeapon
- getWeaponIDFromName
- getWeaponNameFromID
- setWeaponAmmo
- setWeaponProperty