You need to create a weaponholder. Working example which happens to be from an init.sqs but you can do it anywhere.
weaponH1 = "weaponHolder" createVehicle getMarkerPos "WH"
weaponH1 addMagazineCargo ["kozliceball", 4]
weaponH1 addMagazineCargo ["kozliceshell", 4]
weaponH1 addWeaponCargo ["kozlice", 1]
weaponH1 setPos getMarkerPos "WH"
weaponH1 setDir 70
Search the forum, this came up a few weeks ago.