i'm a new coder and my SWEP isn't working

the code can be found here-

i have the info file in the same file as the code.
lua/weapons/(info and swep)

i’ve been at this 5 hours and i still can’t figure out how to fix it, but it doesn’t appear on the weapons menu like it should D=

Use pastebin.com instead, it’s a royal pain in the rear to read code with no indendation or formatting.

ok, posted on placebin as well. http://pastebin.com/uYb9HYZa

That’s where your fault , if you want to use your swep in addon format you must create a folder named “My Swep” ( or however you want to name it ) in garrysmod/addons . Copy info.txt and “lua” folder into your “My Swep” folder and you’re all good

tried that. addons/myfiles/lua/(blah blah)


Make sure you have all the files placed in the right folder.

that looks like it will work, i’ll try that now


nope, didn’t work… maybe i did the info.txt wrong, would that affect it? or is it a coding error? i did it EXACTLY like that.


what you should put in info.txt :

	"name"		""
	"version"	""
	"up_date"  	""
	"author_name"	""
	"author_email"	""
	"author_url"	""

Fill quotes ("") with things

After ,Put your weapon code in shared.lua

it still isn’t working, I did it exactly that way, too (except i named the file “MySWEPS” instead of “my_swep”)

the file has to be called info, the folder it’s in can be called whatever

could one of you test it and tell me if it is a coding error or a file error, if it works for one of you it’s a filing error.

Remove the single - you have in the code they’re gonna cause errors and add to the top of the code.

[lua]if SERVER then

So lets go through a list, Check off what ya have;
You have a “info.txt” inside this is
“name” “”
“version” “”
“up_date” “”
“author_name” “”
“author_email” “”
“author_url” “”
then you have a the following folders(Named as such. > implies the contents of the prevoius folder)
LUA>Weapons>[SWEP folder name]>shared.lua
(You also could potentialy have “cl_inti.lua” or “inti.lua”)

Assuming this is all in order and your SWEP folder name is NOT
(Can’t override HL2 stock weapon names)

Insert the code Cubar posted
if (SERVER) then
at the top of the SWEP, and everything should work

i’ll try that in a bit, thanks =D (i expected people to get angry and frustrated at me for some reason, didn’t expect you to be so nice and helpful about it :D)

also, i don’t have an init.lua or a cl_init.lua

well, sorry to say, i’ve tried loads of things all day. It just won’t work! could someone else please try it on their computer so we know what the error is?

Post the new Lua code.

How about you just zip the entire folder and upload it to www.filebox.me

Look, this guy has not coded it right at all, after everything there’s a - for some weird reason.

hmm that might have something to do with it