WeaponClient

giveDelayedWeaponToPed

GIVE_DELAYED_WEAPON_TO_PED0xB282DC6EBD803C75

The GTA V native GIVE_DELAYED_WEAPON_TO_PED of the WEAPON namespace, as LS:MP client scripts call it: the global function giveDelayedWeaponToPed, in JavaScript and in Lua.

SignatureJavaScript
giveDelayedWeaponToPed(
  ped: Ped,
  weaponHash: Hash,
  ammoCount: number,
  bForceInHand: boolean
): void
SignatureLua
giveDelayedWeaponToPed(
  ped: Ped,
  weaponHash: Hash,
  ammoCount: integer,
  bForceInHand: boolean
)

Usage

JavaScript
giveDelayedWeaponToPed(ped, weaponHash, ammoCount, bForceInHand);
Lua
giveDelayedWeaponToPed(ped, weaponHash, ammoCount, bForceInHand)

Parameters

ParameterTypeJavaScriptLua
pedPednumberinteger
weaponHashHashnumberinteger
ammoCountintnumberinteger
bForceInHandBOOLbooleanboolean

Returns

Nothing. In JavaScript the call evaluates to undefined.

Notes

From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.

Gives a weapon to PED with a delay, example:

giveDelayedWeaponToPed(playerPedId(), getHashKey("WEAPON_PISTOL"), 1000, false)
Full list of weapons by DurtyFree: https://github.com/DurtyFree/gta-v-data-dumps/blob/master/weapons.json

Reference

Namespace
Weapon WEAPON
In the game
void GIVE_DELAYED_WEAPON_TO_PED(Ped ped, Hash weaponHash, int ammoCount, BOOL bForceInHand)
Hash
0xB282DC6EBD803C75

Open in the interactive natives reference