- Documentation
- Server functions
- getPedWeaponSlot
Function
getPedWeaponSlot
Returns the slot number (0-12) of the weapon a ped is currently holding. The slot follows from the weapon type: e.g. handguns are slot 2, assault rifles slot 5. When the ped is holding fists it returns 0.
Syntax
int getPedWeaponSlot(ped ped)Arguments
pedped- A player or an NPC.
Returns
Slot number 0-12.
Example
addCommandHandler("slot", function(player)
outputChatBox("Aktywny slot: " .. getPedWeaponSlot(player), player)
end)
See also
setPedWeaponSlotSwitches the weapon in a ped's hand to the one in the given inventory slot, as if the player scrolled the mouse wheel. The slot must contain a weapon; an empty slot (except 0, i.e. fists) givesfalse. The change reaches the player's game immediately.getSlotFromWeaponReturns the inventory slot (0-12) a weapon ID goes into.getPedWeaponReturns the ID of the weapon a ped is holding (0 = fists), or of the weapon in the given inventory slot. Slots are weapon groups: 0 fists, 1 melee, 2 handguns, 3 shotguns, 4 sub-machine guns, 5 assault rifles, 6 rifles, 7 heavy weapons, 8 grenades, 9 sprays and extinguishers, 10 gifts, 11 goggles and parachute, 12 detonator. On the client it returns only the weapon in hand.