_CREATE_WEAPON_OBJECT
Creates a world object for the weapon weaponHash with the given ammo, position and scale, and returns its handle.
Load the weapon asset first with _REQUEST_WEAPON_ASSET.
Signature
Object _CREATE_WEAPON_OBJECT(Hash weaponHash, int ammoCount, float x, float y, float z, BOOL showWorldModel, float scale); // 0x9888652B8BA77F73 b1207Parameters
| # | Name | Type |
|---|---|---|
| 1 | weaponHash | Hash |
| 2 | ammoCount | int |
| 3 | x | float |
| 4 | y | float |
| 5 | z | float |
| 6 | showWorldModel | BOOL |
| 7 | scale | float |
Facts
| Name | _CREATE_WEAPON_OBJECT |
|---|---|
| Hash | 0x9888652B8BA77F73 |
| Namespace | |
| Returns | Object |
| Game build | 1207 |
Examples
Calls by hash work in every RedM runtime. Replace the placeholder arguments with your own values.
local objectOut = Citizen.InvokeNative(0x9888652B8BA77F73, -- _CREATE_WEAPON_OBJECT
GetHashKey("weapon_revolver_cattleman"), -- Hash weaponHash
0, -- int ammoCount
0.0, -- float x
0.0, -- float y
0.0, -- float z
false, -- BOOL showWorldModel
0.0, -- float scale
Citizen.ResultAsInteger()
)
print(objectOut)// Whole JS numbers are sent as integers: pass floats like 1.5 (or n + 0.0000001), never 1.
const objectOut = Citizen.invokeNative("0x9888652B8BA77F73", // _CREATE_WEAPON_OBJECT
GetHashKey("weapon_revolver_cattleman"), // Hash weaponHash
0, // int ammoCount
0.0, // float x
0.0, // float y
0.0, // float z
false, // BOOL showWorldModel
0.0, // float scale
Citizen.resultAsInteger()
);
console.log(objectOut)int objectOut = Function.Call<int>((Hash)0x9888652B8BA77F73, // _CREATE_WEAPON_OBJECT
(uint)API.GetHashKey("weapon_revolver_cattleman"), // Hash weaponHash
0, // int ammoCount
0.0f, // float x
0.0f, // float y
0.0f, // float z
false, // BOOL showWorldModel
0.0f // float scale
);Related WEAPON natives
- _GIVE_WEAPON_COMPONENT_TO_WEAPON_OBJECT
- REMOVE_WEAPON_COMPONENT_FROM_WEAPON_OBJECT
- _GET_PED_WEAPON_OBJECT
- _GET_WEAPON_FROM_DEFAULT_PED_WEAPON_COLLECTION
- _GET_WEAPON_GUN_SPINNING_WEAPON_EMOTE_TRICK_TYPE_HASH
- _GET_WEAPON_OBJECT_FROM_PED
- _REGISTER_WEAPON_OBJECT_FOR_IGNITION
- HAS_WEAPON_GOT_WEAPON_COMPONENT
- IS_WEAPON_MELEE_WEAPON
- _CLEAR_PED_LAST_WEAPON_DAMAGE
- _ATTACH_WEAPON_TO_HORSE_HOLSTER
- _DELETE_WEAPON_OBJECTS_ON_HORSE
Facts compiled from community research (alloc8or/rdr3-nativedb-data, femga/rdr3_discoveries); descriptions and examples by The Lab.