http://pastebin.com/aGd2yDe9
That's my code.
You are getting the errors because you are not deriving the weapon from the TTT baseclass. Use:
SWEP.Base = "weapon_tttbase"
The model will hold it wrong because "crowbar" is not a valid HoldType value. Set it to:
SWEP.HoldType = "melee"
Other things:
- Don't set SWEP.WeaponID. It's only for the weapons that come with TTT. Have you looked at the code for weapon_tttbase? It has a lot of comments that tell you these things.
- Don't define a SWEP:Initialize() override unless you know what you're doing. The TTT weapon base does important things in that function.
- Because "isRunning" is global, you will run into weird behaviour when multiple traitors use the weapon. Make it SWEP.isRunning.
- Test regularly on a listen server rather than singleplayer. Singleplayer is special and you will not see certain issues. For example, the client has no "SetWalkSpeed" function for players because it's server-side. Your code will try to set the player's speed on the client in multiplayer and give an error.
Also, I made this icon: How would I about converting it for use with ingame pictures in the menu?
/gamemodes/terrortown/template/icon.psd
Stick your image on that background in photoshop. Export to VTF (BGRA8888, point sample, no mipmap, no level of detail). Make sure you give it a unique filename (eg. with your server name in it) because otherwise it can clash with icons from other servers. Make a VMT based on the VMTs for standard TTT icons. Stick a
resource.AddFile in your weapon code to make clients download it.
If I were you I'd just use the standard crowbar icon until the weapon itself was fully working and turns out to be fun and balanced, or all that effort will be for nothing. To use the crowbar:
SWEP.Icon = "VGUI/ttt/icon_cbar"
I would like to write a guide about custom weapons with more detail than this, because I realise it's tough to make a weapon right now unless you're well versed in Gmod's Lua stuff, but I just don't have time right now. Maybe in a few weeks.