Skip to main content

addWeaponComponent

xPlayer.addWeaponComponent(weaponName, weaponComponent)

This function adds a weapon component to a weapon, if the player has it, the available component list can be found in the weapon configuration file.

Arguments

ArgumentData TypeOptionalDefault ValueExplanation
weaponNamestringNo-Weapon name
weaponComponentstringNo-Weapon component

Example

xPlayer.addWeapon('WEAPON_ASSAULTRIFLE', 50)
xPlayer.addWeaponComponent('WEAPON_ASSAULTRIFLE', 'clip_drum')
xPlayer.addWeaponComponent('WEAPON_ASSAULTRIFLE', 'flashlight')