- Documentation
- Server functions
- setCurrentWeapon
Function
setCurrentWeapon
Puts a weapon the ped already has into its hand (weapon number, e.g. 31 = M4; 0 = fists). Another name: setPedWeaponSlot.
Syntax
bool setCurrentWeapon(ped thePed, int weapon)Arguments
thePedped- The ped.
weaponint- Weapon number.
Returns
true if the ped has that weapon.
Example
giveWeapon(player, 31, 200)
setCurrentWeapon(player, 0)
See also
giveWeaponGives a ped a weapon with ammo. If the ped already has a weapon in that slot, it is replaced.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.