createWeaponObject
CREATE_WEAPON_OBJECT0x9541D3CF0D398F36The GTA V native CREATE_WEAPON_OBJECT of the WEAPON namespace, as LS:MP client scripts call it: the global function createWeaponObject, in JavaScript and in Lua.
createWeaponObject(
weaponHash: Hash,
ammoCount: number,
x: number,
y: number,
z: number,
showWorldModel: boolean,
scale: number,
p7: any,
p8: any,
p9: any
): ObjectcreateWeaponObject(
weaponHash: Hash,
ammoCount: integer,
x: number,
y: number,
z: number,
showWorldModel: boolean,
scale: number,
p7: any,
p8: any,
p9: any
): ObjectUsage
JavaScript
const object = createWeaponObject(
weaponHash, ammoCount, x, y, z, showWorldModel, scale, p7, p8, p9
);Lua
local object = createWeaponObject(
weaponHash, ammoCount, x, y, z, showWorldModel, scale, p7, p8, p9
)Three consecutive numbers can be given as one vector: { x, y, z } (or [x, y, z]) in JavaScript, a Vector3 in Lua.
JavaScript · with vectors
const object = createWeaponObject(
weaponHash, ammoCount, pos, showWorldModel, scale, p7, p8, p9
);Lua · with vectors
local object = createWeaponObject(weaponHash, ammoCount, pos, showWorldModel, scale, p7, p8, p9)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
weaponHash | Hash | number | integer |
ammoCount | int | number | integer |
x | float | number | number |
y | float | number | number |
z | float | number | number |
showWorldModel | BOOL | boolean | boolean |
scale | float | number | number |
p7 | Any | any | any |
p8 | Any | any | any |
p9 | Any | any | any |
Returns
Object JavaScript number, Lua integerGame handle of an object (prop). Not an LS:MP netId. Convert one with lsmp.getEntityFromNetId.
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Now has 8 params.
Reference
- Namespace
- Weapon WEAPON
- In the game
Object CREATE_WEAPON_OBJECT(Hash weaponHash, int ammoCount, float x, float y, float z, BOOL showWorldModel, float scale, Any p7, Any p8, Any p9)- Hash
0x9541D3CF0D398F36