- Documentation
- Server functions
- givePedWeapon
Function
givePedWeapon
Gives a ped a weapon with ammo, exactly like giveWeapon (it is the same function under another name). If the ped already has a weapon in the same slot, it is replaced, while ammo for the same weapon adds up.
Syntax
bool givePedWeapon(ped ped, int weapon [, int ammo = 30, bool setAsCurrent = false])Arguments
pedped- A player or an NPC.
weaponint- Weapon ID, e.g. 24 = Desert Eagle, 31 = M4, 34 = sniper rifle.
ammoint, optional = 30- Number of rounds to add.
setAsCurrentbool, optional = falsetrue= the ped takes the weapon in hand right away.
Returns
true on success.
Example
addCommandHandler("m4", function(player)
givePedWeapon(player, 31, 200, true)
end)