Players can't reload newly spawned empty weapons

Hi guys. Yeah, it’s me, Inconceivable. I know a lot of you don’t like me very much, so I try to stay away from facepunch because I don’t like drama and I’m sure you don’t either. But I’m stuck here and I need some help. So if you don’t want to help, I understand. I just don’t know where else to ask. Okay, here we go. Be gentle.

When players have set the weapons to spawn with no bullets by default, the newly spawned weapons don’t respond fire or reload button presses. Players can’t reload their weapons once they get ammo, and they can’t fire to trigger the reload either. I’ve tested with a couple PrintMe’s in the PrimaryAttack and Reload functions, and I never see any messages or errors in the console. It’s like the weapon doesn’t even know that the player if pressing fire. But once the player switches out and returns to the weapon, it acts just fine. Players can fire and reload as they wish.

I’m not getting any lua errors in the console. Weapons initialize, equip, and deploy, but aren’t reloadable until swapped out and picked up again. This only happens if the weapons spawn without any ammo. I’m stuck, I’m out of ideas and it’s midterm time, so the pressure is on real hard here. Can anyone offer any clues?

My code is almost 1300 lines long, so instead of posting it all, here’s a pastebin:



Nevermind, I found it! A long time ago, I had set the secondary ammo to “none” but I should have just left it as “”. After emptying the quotes, the weapons act as intended. Problem solved!

Please consider this the olive branch. I know that many of you are smart and talented coders, and I also know many of you dislike me and the M9K series. I don’t want that kind of trouble and negativity, I come in peace. I just want to share easy-to-use weapons.

So Admins, you can lock the thread. Thanks for your time.