{"name":"addWeaponWithAttachmentsCargoGlobal","title":"addWeaponWithAttachmentsCargoGlobal","type":"command","url":"https://community.bistudio.com/wiki/addWeaponWithAttachmentsCargoGlobal","revid":377640,"updated":"2026-01-02T08:52:38Z","groups":["Vehicle Inventory"],"status":"ok","games":{"arma3":"1.94"},"since":"arma3 1.94","arma3_since":"1.94","locality":{"argument":"global","effect":"global"},"description":"Adds a weapon into the cargo space of a vehicle / box with given attachments / magazines. Ignores available cargo space. If the weapon class has any pre-attached items (LinkedItems), they are removed and new items, supplied via command arguments, are added.","syntaxes":[{"syntax":"container addWeaponWithAttachmentsCargoGlobal [weaponConfiguration, weaponsCount]","params":[{"name":"container","type":"Object","description":"container to add the weapon to. Might be a backpack, ammobox or vehicle.","type_expr":"Object"},{"name":"weaponConfiguration","type":"Array with [weapon, muzzle, flashlight, optics, primaryMuzzle, secondaryMuzzle, bipod]","description":"- weapon: String - Weapon class name from CfgWeapons\n- muzzle: String - Muzzle attachment class name. Use \"\" if not needed.\n- flashlight: String - Side rail attachment class name. Use \"\" if not needed.\n- optics: String - Top rail attachment class name. Use \"\" if not needed.\n- primaryMuzzle: Array with [primaryMuzzleMagazine, primaryAmmoCount] - Use [] if not needed\n  - primaryMuzzleMagazine: String - Magazine class name\n  - primaryAmmoCount: Number - Ammo count in magazine (will be clipped to values between 0 and the maximum capacity of the magazine class)\n- secondaryMuzzle: Array with [secondaryMuzzleMagazine, secondaryAmmoCount] - Use [] if not needed\n  - secondaryMuzzleMagazine: String - Magazine class name\n  - secondaryAmmoCount: Number - Ammo count in magazine (will be clipped to values between 0 and the maximum capacity of the magazine class)\n- bipod: String - Underbarrel rail attachment class name. Use \"\" if not needed.\n\nThis array has the same format as the array returned by the weaponsItems command.","type_expr":"Array","text":"weaponConfiguration: Array with [weapon, muzzle, flashlight, optics, primaryMuzzle, secondaryMuzzle, bipod]\n\n- weapon: String - Weapon class name from CfgWeapons\n- muzzle: String - Muzzle attachment class name. Use \"\" if not needed.\n- flashlight: String - Side rail attachment class name. Use \"\" if not needed.\n- optics: String - Top rail attachment class name. Use \"\" if not needed.\n- primaryMuzzle: Array with [primaryMuzzleMagazine, primaryAmmoCount] - Use [] if not needed\n  - primaryMuzzleMagazine: String - Magazine class name\n  - primaryAmmoCount: Number - Ammo count in magazine (will be clipped to values between 0 and the maximum capacity of the magazine class)\n- secondaryMuzzle: Array with [secondaryMuzzleMagazine, secondaryAmmoCount] - Use [] if not needed\n  - secondaryMuzzleMagazine: String - Magazine class name\n  - secondaryAmmoCount: Number - Ammo count in magazine (will be clipped to values between 0 and the maximum capacity of the magazine class)\n- bipod: String - Underbarrel rail attachment class name. Use \"\" if not needed.\n\nThis array has the same format as the array returned by the weaponsItems command."},{"name":"weaponsCount","type":"Number","description":"number of weapons to add","type_expr":"Number"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"container"},"right":{"text":"[weaponConfiguration, weaponsCount]"}}],"examples":[{"code":["cursorObject addWeaponWithAttachmentsCargoGlobal [[\"arifle_MX_GL_F\", \"muzzle_snds_H\", \"\", \"optic_aco\", [\"30Rnd_65x39_caseless_mag\", 15], [\"3Rnd_HE_Grenade_shell\", 2], \"\"], 2];"]},{"text":"Add five MX GL rifles, each with flashlight side attachment, a full 30 rounds magazine loaded into the gun and a full 3Rnd HE grenade magazine loaded into the grenade launcher:\n\n```sqf\ncursorObject addWeaponWithAttachmentsCargoGlobal [[\"arifle_MX_GL_F\", \"\", \"acc_flashlight\", \"\", [\"30Rnd_65x39_caseless_mag\", 30], [\"3Rnd_HE_Grenade_shell\", 2], \"\"], 5];\n```","code":["cursorObject addWeaponWithAttachmentsCargoGlobal [[\"arifle_MX_GL_F\", \"\", \"acc_flashlight\", \"\", [\"30Rnd_65x39_caseless_mag\", 30], [\"3Rnd_HE_Grenade_shell\", 2], \"\"], 5];"]},{"text":"Add one MX rifle without any attachments or magazines event though the class has linked items:\n\n```sqf\ncursorObject addWeaponWithAttachmentsCargoGlobal [[\"arifle_MX_Holo_pointer_F\", \"\", \"\", \"\", [], [], \"\"], 1];\n```","code":["cursorObject addWeaponWithAttachmentsCargoGlobal [[\"arifle_MX_Holo_pointer_F\", \"\", \"\", \"\", [], [], \"\"], 1];"]},{"text":"Add all weapons on player with attachments:\n\n```sqf\n{ cursorObject addWeaponWithAttachmentsCargoGlobal [_x, 1] } forEach weaponsItems player;\n```","code":["{ cursorObject addWeaponWithAttachmentsCargoGlobal [_x, 1] } forEach weaponsItems player;"]}],"see_also":["addWeaponWithAttachmentsCargo","weaponsItems","addWeaponCargo","addWeaponCargoGlobal","clearWeaponCargo","getWeaponCargo"],"notes":[{"user":"Andrew_S90","date":"2020-10-28T20:57:00Z","text":"This command also allows you to add a weapon with attachments directly to the players backpack.\n\n```sqf\n(backpackContainer player) addWeaponWithAttachmentsCargoGlobal [[\"arifle_MX_F\",\"muzzle_snds_H\",\"acc_pointer_IR\",\"optic_Hamr\",[\"30Rnd_65x39_caseless_mag\",30],[],\"bipod_03_F_blk\"], 1];\n```"}]}