Uploading my first addon

I am trying to upload my first addon. I have already uploaded it but when I start up a single player game it says “Addon Gravity Minimizer Is Creating Script Errors.” I have looked all over the internet for a detailed a thorough way to make a SWEP and upload it to the workshop. I am using Workshoper to upload the addon as it seems easier. For now I will delete the addon until I can fix this. I do not have a addon.txt file in my addon as I was told that I do not need one. The problem I have after subscribing to the addon is it does not show up in-game under the weapons category. In fact it does not show up in any categories.

I know this is shit content but we all have to start somewhere. This is mostly for me to figure out how to do this dumb crap.

Folder Structure:
Gravity Editor\lua\weapons\gravity minimizer\shared.lua
Gravity Editor\sound\weapons\gravity minimizer\gravitychange.wav

Those are the only things in my folder ^

This is my lua code for the weapon in shared.lua


if SERVER then //init stuff
 
	//This makes sure clients download the file
	AddCSLuaFile ("shared.lua")
	//How heavy the SWEP is
	SWEP.Weight = 1
 
	//Allow automatic switching to/from this weapon when weapons are picked up
	SWEP.AutoSwitchTo = false
	SWEP.AutoSwitchFrom = false
 
elseif CLIENT then // client stuff
 

	SWEP.PrintName = "Gravity Minimizer"
	SWEP.Slot = 1
	SWEP.SlotPos = 3
	SWEP.DrawAmmo = false
	SWEP.DrawCrosshair = false 
end
	
	SWEP.Author = "Praesdynamite"
	SWEP.Contact = "amrcommunity.com"
	SWEP.Purpose = "Minimizes gravity for the player"
	SWEP.Instructions = "Right click to reduce gravity. Left click to set to normal"
	SWEP.Category = "weapons"
	SWEP.Spawnable = true -- Whether regular players can see it
	SWEP.AdminSpawnable = true -- Whether Admins/Super Admins can see it

	SWEP.ViewModel = "models/weapons/v_hands.mdl" -- What the player with the gravity minimizer sees
	SWEP.WorldModel = "models/weapons/w_hands.mdl" -- What other players see.
	
	//Left click information
	SWEP.Primary.ClipSize 		= -1
	SWEP.Primary.DefaultClip 	= -1
	SWEP.Primary.Ammo 			= "none"
	SWEP.Primary.Delay          = 10
	SWEP.Primary.Automatic = false
	
	//Right click stuff
	SWEP.Secondary.ClipSize = -1
	SWEP.Secondary.DefaultClip = -1
	SWEP.Secondary.Automatic = false
	SWEP.Secondary.Ammo = "none"
	
	
local GravitySound = Sound("sound\weapons\gravity minimizer\gravitychange.wav")
	
function SWEP:PrimaryAttack()
	self:SetGravity(100)
	self:EmitSound(GravitySound)
end

function SWEP:SecondaryAttack()
	self:SetGravity(600)
	self:EmitSound(GravitySound)
end

function SWEP:Reload()
	self:PrintMessage( HUD_PRINTTALK, "This does nothing XD!" )
end



I would like to know why this isn’t showing up in-game and if this SWEP has any errors. Or perhaps if this thing can actually work.

[editline]29th August 2014[/editline]

BTW If someone could help me with this I am planning on making a detailed Youtube video that describes every step from coding to uploading to the workshop as there seems to be no good hands on tutorials out there.

[editline]29th August 2014[/editline]

No one has any ideas…?

-snip- Oh, I thought you wanted comments…

EDIT: You never ended the elseif CLIENT then


elseif CLIENT then // client stuff
 

	SWEP.PrintName = "Gravity Minimizer"
	SWEP.Slot = 1
	SWEP.SlotPos = 3
	SWEP.DrawAmmo = false
	SWEP.DrawCrosshair = false 
end <------------

Are you sure I didn’t end the elseif statement?

And… what are the errors?

I looked at console and I did not see anything…

Edit: I suppose I will make the file a .gma again and look in console again.

Btw no one’s going to spoon feed you so don’t even tell us you “need to be spoon fed”

okey dokey

You can replace this whole thing:



if SERVER then //init stuff
 
	//This makes sure clients download the file
	AddCSLuaFile ("shared.lua")
	//How heavy the SWEP is
	SWEP.Weight = 1
 
	//Allow automatic switching to/from this weapon when weapons are picked up
	SWEP.AutoSwitchTo = false
	SWEP.AutoSwitchFrom = false
 
elseif CLIENT then // client stuff
 

	SWEP.PrintName = "Gravity Minimizer"
	SWEP.Slot = 1
	SWEP.SlotPos = 3
	SWEP.DrawAmmo = false
	SWEP.DrawCrosshair = false 
end

With this:




//This makes sure clients download the file
AddCSLuaFile() -- No arguments means include itself for download

//How heavy the SWEP is
SWEP.Weight = 1
 
//Allow automatic switching to/from this weapon when weapons are picked up
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

SWEP.PrintName = "Gravity Minimizer"
SWEP.Slot = 1
SWEP.SlotPos = 3
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false 


As for your problem, post the actual errors.

I will post the errors. I just need to make a file a .gma again.

[editline]29th August 2014[/editline]


[Gravity Minimizer] lua/weapons/gravity minimizer/shared.lua:48: invalid escape sequence near '"sound'
  1. unknown - lua/weapons/gravity minimizer/shared.lua:0


This is the error.

Also just before the error this appears:


TEST [lua/weapons/gravity minimizer/shared.lua][lua/weapons/gravity minimizer/shared.lua]
FOUND IN ADDON [307368252]



I am not sure if this has to do with anything.

local GravitySound = Sound(“sound\weapons\gravity minimizer\gravitychange.wav”)

Don’t use backwards slashes, use forward slashes

Thank you for everyone who helped. Especially this^

And yes it worked