Find the item's classname
Every item has a classname, such as M4A1 or BakedBeansCan. Use the exact spelling: DayZ ignores entries it can't match. Modded items use the classname the mod author gives.
Add or copy an entry
Copy the entry for a similar item and change the name. A rifle copied from another rifle already has sensible lifetime, category and usage. Then set nominal and min above zero.
Choose where it spawns
Set its usage (Military, Police, Town and so on) and value tiers. Without a usage it has nowhere to appear. See loot tiers.
Check and restart
Validate the file with the XML validator, upload it and restart. Give the economy a little time to spawn the new item.
Where to find classnames
The easiest way is to look in your own types.xml, since every vanilla item is already there. Search for a word you know, such as Mosin or Canteen, and you'll find the exact classname. For modded items on PC, the mod's own files or its page usually list them.
Spelling counts. A missing capital or an extra space means the entry doesn't match anything, and the item never spawns.
Pick sensible numbers
Copying a similar item gives you a starting point. Then:
- Nominal: start low, such as 5 for a weapon, and raise it later
- Min: about half of nominal, so the economy tops it up before it runs out
- Lifetime: copy from a similar item, usually a few hours for weapons
- Restock: 0 for common items, longer for rare ones so they can't be farmed
Attachments and ammo
Adding a weapon doesn't give it magazines or ammo. Make sure those have entries with nominal above zero too, and decide in cfgspawnabletypes.xml what the weapon spawns with. See weapon attachments.
Test a new item
Before you set the final numbers, set nominal and min a little higher than you want, restart and check the item appears where you expected. Once you've seen it in game, bring the numbers down to their final values. It's quicker than waiting days to find out an item never spawns.