Stop players from getting ammo for a gun after spawning it?

I changed SWEP.DefaultClip from 30 to 0 and it still gives people 30 rounds to start with.

Thanks for reading

EDIT:

If it matters it’s for CW 2.0 Weapons pack

Look for the number 30 in the script and delete it. Alternatively you can just create your own custom hook and just set the ammo to 0 when picked up (if picked up for the first time)

Please set the below
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0

You have to set secondary clip as well, otherwise you still get ammo. Commenting that section out gives ammo as well.

Correct me if i’m wrong, but SWEP.Secondary.ClipSize is just the size of the clip for the right click action, isn’t it?

You can take a look at cityscript to see how I did this if you like

Do a search in the code for DefaultClip and see what the code does. (look in cityscript/gamemode/items.lua)

So basically just set SWEP.Secondary.DefaultClip = 0;?

Basically yes, but do it at the right moment. The complexity comes in when you want the amount of ammo in the clip to stay in the dropped weapon and then get picked up again with the weapon. I figured that was what you would ultimately want to do…

Normally, you can drop and pick up weapons to keep adding ammo (at least in some DarkRP servers, this happens).

I’m just trying to change it so that when the weapon is bought on the F4 menu it’s completely empty.

DarkRP has something called clip1 which is how much ammo is in the gun by default when you buy it. If i set that to 0, there’s still 30 left in the reserve after i pick the weapon up.

That’s because there is no “reserve”. This confused me at first, too. The “Reserve” is the amount of extra bullets the player has of that type.

For example, if your weapon’s primary ammo type is smg1, your weapon will contain an amount (the amount in the magazine) and your player will have some ammo of that type, too.

When you reload, the bullets that the player has are placed into the magazine.

There’s no “reserve” - it’s just bullets of that type that the player has.

Is this gun from the workshop and you’ve extracted the .gma file/added them to your server?

If yes, editing the files won’t work. Workshop files take priority.