So, I made this specifically because I was having trouble with getting some custom weapon scripts to work and load ammo that was made using the ammo_base, or just the pre-made HL2 ammo, so I figured I'd share it in case some other poor sap comes across the same problem as me. It's really simple: I kind of re-invented the wheel and removed the potential for getting cockblocked by not having a proper weapon equipped.
Code:
-- Created by NoahtheBoah36 AKA Noah Engelmann
-- Rights to redistribute/reuse/modify are granted, provided credit is given.
local ITEM = Clockwork.item:New();
ITEM.name = "Ammo Box";
ITEM.model = "models/clutter/ammobox.mdl";
ITEM.weight = 0.5;
ITEM.useText = "Open";
ITEM.category = "Ammo";
ITEM.business = true;
ITEM.access = "B";
ITEM.description = "A box filled with lots of ammo of various kinds.";
-- Dropping the item.
function ITEM:OnDrop(player, position) end;
-- Using the item.
function ITEM:OnUse(player, itemEntity)
player:GiveAmmo(100, "ar2");
player:GiveAmmo(100, "smg1");
player:GiveAmmo(100, "pistol");
player:GiveAmmo(100, "buckshot");
player:GiveAmmo(100, "357");
player:GiveAmmo(100, "xbowbolt");
player:GiveAmmo(100, "rpg_round");
player:GiveAmmo(100, "smg1_grenade");
player:GiveAmmo(100, "ar2altfire");
end;
ITEM:Register();
As the comments say, feel free to use this if you're having trouble implementing custom weapons onto your server that use some specific kind of ammo, and feel free to edit it to your preferences by removing ammo types or adding ammo types from other things. The current state of it, however, has all default hl2 ammo types included, with the exception of "grenade" and "slam" ammo, since such things aren't really ammo so I didn't think of including it.
P.S. That model is part of a special model pack as I'm using this for something specific, so make sure you change the model path to something else!