You can use a unit event--I tried googling but couldn't find an ammo system/tutorial I could link you to.
In any case, trying using an event like Event - A unit is attacked.
Inside the trigger action, you will get the attacking unit, and from that get the owner of the attacking unit. Then simply subtract their gold based on how much ammo is used in each shot (could vary based on weapons).
Note this won't prevent someone from shooting if they have no ammo--instead you'd have to detect when a player's gold is 0, and then order their unit to stop attacking.