Skip to content

utils.weapon.getComponent

utils.weapon.getComponent(weaponName, weaponComponent)
This function returns the weapon component object for a weapon. Includes the component label, name and hash key. See the weapon config file for the available components.

Arguments

Argument Data Type Optional Default Value Explanation
weaponName string No - Sets weapon name
weaponComponent string No - Sets component of weapon

Note

You can see all weapons here <Link not create yet>.

Dependency

local utils = M("utils")

Example

Note

Use utils.weapon.get(weaponName) to find the component or search in weapons.json file.

local weaponComponent = utils.weapon.getComponent('WEAPON_ASSAULTRIFLE', "COMPONENT_ASSAULTRIFLE_CLIP_01")
local tableDump = utils.table.dump(weaponComponent)

print(tableDump) -- Returns all information about this weapon component
local weaponComponent = utils.weapon.getComponent('WEAPON_ASSAULTRIFLE', "COMPONENT_ASSAULTRIFLE_CLIP_01")

print(weaponComponent.label) -- Returns component label of weapon

Improve this documentation