Adding Custom weapon to the Gamemode loadout.

Well, I am wanting to make a gamemode and but I am having trouble adding a custom weapon that I coded with this tutorial: http://wiki.garrysmod.com/?title=Your_First_Scripted_Weapon

It is exact(at least I think it is - I have compared them) and I typed it all by hand no c/p. I saved as shared.lua - Here is pastebin: http://pastebin.com/ervKNcH9

But when I add it to the layout with ply:Give( “custom_weapon” ) … it doesn’t show up. I have downloaded the Skeleton gamemod from garrysmod.org and put it into the entities/weapons folder. So my shared.lua file is in “custom_weapon” folder in the location.

The empty_weapon included which was a sample weapon in the skeleton gamemode does work when I add it to the loadout and I noticed it was coded a little differently.

So basically what I am asking is how do i get my custom weapon to show on the loadout.

Ok
Say like your Gamemode is in the gamemodes folder in Garrsymod/garrysmod

Well go into your gamemode folder

Goto gamemodes/(yourgamemode)/entities/weapons

Then if u have stuff like

Gmdm_pistol

then
Shared.lua then replace the code with whatever

I did that with GMDM

I have that.

I have a folder in the gamemodes/(yourgamemode)/entities/weapons called custom_weapon and then in the function GM:PlayerLoadout( ply ) i have ply:Give( “custom_weapon” ) but nothing is showing for it in game.

[editline]5th July 2011[/editline]

I just noticed that the tut puts “;” on the end of lines and most all other code and other examples do not. After removing, It still hasnt worked but just my observation.

the ‘;’ is a C habit for some people. And are you getting any errors from the weapon in your console?

Aww yes, here it is:

Line 56 in pastebin:

[lua] if (!SERVER) then retrun end;[/lua]

Change ‘retrun’ to ‘return’ :v:

Yep thanks, just noticed the error line 59. It’s always the simplest errors.

Is there a way to stop this from appearing on my hud?
[gamemodes\bizrp\entities\weapons\custom_weapon\shared.lua:69] attempt to call field ‘Owner’ (a userdata value)

SOLVED!

I would rename your file to shared.lua not sha red.lua

It was just a copy from the console so when it wrapped the text it added it. It is shared.lua but thanks. No need to bump plz.