GIVE_WEAPON_TO_PED
Gives the ped the weapon.
Hash
0x5E3BDDBCB83F3D84Runtime name
GiveWeaponToPedNamespaceWEAPON
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
| Name | Type | Description |
|---|---|---|
ped | Ped | — |
weaponHash | Hash | — |
ammoCount | int | — |
bForceInHand | BOOL | — |
bForceInHolster | BOOL | — |
attachPoint | int | — |
bAllowMultipleCopies | BOOL | — |
p7 | float | — |
p8 | float | — |
addReason | Hash | — |
bIgnoreUnlocks | BOOL | — |
permanentDegradation | float | — |
p12 | BOOL | — |
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
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#
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());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.InvokeNativeneeds the number — passjoaat("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. Write10.0orvalue + 0.0. The generated JS wrappers add0.0000001to non-zero floats for the same reason.
Enums and flags
- eWeaponAttachPoint 33 values
Sources
Something wrong or missing? Contribute a verified note — corrections ship through pull requests.