{"name":"addWeaponWithAttachmentsCargo","operator":null,"title":"addWeaponWithAttachmentsCargo","type":"command","url":"https://community.bistudio.com/wiki/addWeaponWithAttachmentsCargo","revid":377612,"updated":"2026-01-02T08:51:35Z","groups":["Vehicle Inventory"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.94"}],"since":{"game":"arma3","name":"Arma 3","version":"1.94"},"arma3_since":"1.94","branch":null,"locality":{"argument":"global","effect":"local","server_exec":false},"exec":null,"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 addWeaponWithAttachmentsCargo [weaponConfiguration, weaponsCount]","since":null,"effect":null,"exec":null,"params":[{"name":"container","type":"Object","optional":false,"default":null,"description":"container to add the weapon to. Might be a backpack, ammobox or vehicle.","types":["Object"],"since":null,"text":"container: Object - container to add the weapon to. Might be a backpack, ammobox or vehicle."},{"name":"weaponConfiguration","type":null,"optional":false,"default":null,"description":"Array with [weapon, muzzle, flashlight, optics, primaryMuzzle, secondaryMuzzle, bipod]\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.\nThis array has the same format as the array returned by the weaponsItems command.","types":["Array"],"since":null,"text":"weaponConfiguration: Array with [weapon, muzzle, flashlight, optics, primaryMuzzle, secondaryMuzzle, bipod]\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.\nThis array has the same format as the array returned by the weaponsItems command."},{"name":"weaponsCount","type":"Number","optional":false,"default":null,"description":"number of weapons to add","types":["Number"],"since":null,"text":"weaponsCount: Number - number of weapons to add"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"container","types":["Object"]},"right":{"text":"[weaponConfiguration, weaponsCount]","types":["Array"]}}],"examples":[{"text":"```sqf\ncursorObject addWeaponWithAttachmentsCargo [[\"arifle_MX_GL_F\", \"muzzle_snds_H\", \"\", \"optic_aco\", [\"30Rnd_65x39_caseless_mag\", 15], [\"3Rnd_HE_Grenade_shell\", 2], \"\"], 2];\n```","code":["cursorObject addWeaponWithAttachmentsCargo [[\"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 addWeaponWithAttachmentsCargo [[\"arifle_MX_GL_F\", \"\", \"acc_flashlight\", \"\", [\"30Rnd_65x39_caseless_mag\", 30], [\"3Rnd_HE_Grenade_shell\", 2], \"\"], 5];\n```","code":["cursorObject addWeaponWithAttachmentsCargo [[\"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 addWeaponWithAttachmentsCargo [[\"arifle_MX_Holo_pointer_F\", \"\", \"\", \"\", [], [], \"\"], 1];\n```","code":["cursorObject addWeaponWithAttachmentsCargo [[\"arifle_MX_Holo_pointer_F\", \"\", \"\", \"\", [], [], \"\"], 1];"]},{"text":"Add all weapons on player with attachments:\n\n```sqf\n{ cursorObject addWeaponWithAttachmentsCargo [_x, 1] } forEach weaponsItems player;\n```","code":["{ cursorObject addWeaponWithAttachmentsCargo [_x, 1] } forEach weaponsItems player;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["addWeaponWithAttachmentsCargoGlobal","weaponsItems","addWeaponCargo","addWeaponCargoGlobal","clearWeaponCargo","getWeaponCargo"],"notes":[{"user":"Andrew_S90","date":"2020-10-28T21:03:00Z","text":"This command also allows you to add a weapon with attachments directly to the players backpack.\n\n```sqf\n(backpackContainer player) addWeaponWithAttachmentsCargo [[\"arifle_MX_F\",\"muzzle_snds_H\",\"acc_pointer_IR\",\"optic_Hamr\",[\"30Rnd_65x39_caseless_mag\",30],[],\"bipod_03_F_blk\"], 1];\n```"},{"user":"DreadedEntity","date":"2022-04-02T02:52:00Z","text":"This command will let you add millions of weapons across multiple vehicles, but be warned, weird things start happening in-game:\n\n```sqf\n(vehicle player) addWeaponWithAttachmentsCargoGlobal [[\"arifle_MX_F\",\"\",\"\",\"\",[],[],\"\"],1000000];\n```\n\nI don't recommend running the above too many times in the console"}],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Vehicle Inventory","Introduced with Arma 3 version 1.94","Scripting Commands","Scripting Commands: Local Effect"]}