RedM Natives

GIVE_WEAPON_TO_PED

Gives the ped the weapon.

Hash0x5E3BDDBCB83F3D84
Runtime nameGiveWeaponToPed
NamespaceWEAPON
SideClient
NameOfficial
Docs
Since build1207

Signature

Hash GIVE_WEAPON_TO_PED(Ped ped, Hash weaponHash, int ammoCount, BOOL bForceInHand, BOOL bForceInHolster, int attachPoint, BOOL bAllowMultipleCopies, float p7, float p8, Hash addReason, BOOL bIgnoreUnlocks, float permanentDegradation, BOOL p12);

Parameters

NameTypeDescription
pedPed—
weaponHashHash—
ammoCountint—
bForceInHandBOOL—
bForceInHolsterBOOL—
attachPointint—
bAllowMultipleCopiesBOOL—
p7float—
p8float—
addReasonHash—
bIgnoreUnlocksBOOL—
permanentDegradationfloat—
p12BOOL—

Returns Hash

Description

Gives the ped the weapon.
List: https://github.com/femga/rdr3_discoveries/blob/master/weapons/weapons.lua

Params: p7 is 0.5f, and p8 is 1.0f. p11 and p12 are both 0 in R* Scripts
attachPoint: see SET_CURRENT_PED_WEAPON
addReason: see _ADD_AMMO_TO_PED
permanentDegradation: default 0.5, any higher than 0 it will automatically make the weapon worn, you can also adjust the value to change the weapons maximum cleanliness

Usage

Lua
local retval = GiveWeaponToPed(ped, weaponHash, ammoCount, bForceInHand, bForceInHolster, attachPoint, bAllowMultipleCopies, p7, p8, addReason, bIgnoreUnlocks, permanentDegradation, p12)

-- always works, by hash
local retval = Citizen.InvokeNative(0x5E3BDDBCB83F3D84, ped, weaponHash, ammoCount, bForceInHand, bForceInHolster, attachPoint, bAllowMultipleCopies, p7, p8, addReason, bIgnoreUnlocks, permanentDegradation, p12, Citizen.ResultAsInteger())
JavaScript and C#
JavaScript
const retval = GiveWeaponToPed(ped, weaponHash, ammoCount, bForceInHand, bForceInHolster, attachPoint, bAllowMultipleCopies, p7, p8, addReason, bIgnoreUnlocks, permanentDegradation, p12);

// by hash
const retval = Citizen.invokeNative('0x5E3BDDBCB83F3D84', ped, weaponHash, ammoCount, bForceInHand, bForceInHolster, attachPoint, bAllowMultipleCopies, p7 + 0.0000001, p8 + 0.0000001, addReason, bIgnoreUnlocks, permanentDegradation + 0.0000001, p12, Citizen.returnResultAnyway(), Citizen.resultAsInteger());
C#
int retval = Function.Call<int>((Hash)0x5E3BDDBCB83F3D84, ped, weaponHash, ammoCount, bForceInHand, bForceInHolster, attachPoint, bAllowMultipleCopies, p7, p8, addReason, bIgnoreUnlocks, permanentDegradation, p12);
  • Hash parameters: the named function also accepts a string and hashes it for you; Citizen.InvokeNative needs the number — pass joaat("name") or a backtick literal like `name`.
  • Float parameters: Lua integers (10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to non-zero floats for the same reason.

Enums and flags

Sources

alloc8or RDR3 NativeDB

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.