SWEP Problem

My SWEPs aren’t showing up in the weapons tab EVEN when I add SWEP.Category to it!

Here’s What I’m Putting:


SWEP.ViewModelFlip = false
SWEP.Author = "REGIFISHY"
SWEP.Contact = ""
SWEP.Purpose = "Killing npcs of course!"
SWEP.Instructions = "Left click fires a bolt of electricity, while Right click fires a more forceful, rapid blast"
SWEP.PrintName = "Shock pistol"
SWEP.Category = "REGIFISHY"
SWEP.Slot = 2;
SWEP.SlotPos = 1;
SWEP.DrawCrosshair = true;
SWEP.DrawAmmo = false;
SWEP.ViewModel = "models/weapons/railgun/v_railgun.mdl";
SWEP.WorldModel = "models/weapons/railgun/w_railgun.mdl";
SWEP.ViewModelFOV = 70;
SWEP.ReloadSound = "weapons/pistol/pistol_reload1.wav";
SWEP.HoldType = "pistol";
SWEP.Spawnable = true;
SWEP.AdminSpawnable = true;
SWEP.Weight = 1;
SWEP.AutoSwitchTo = false;
SWEP.AutoSwitchFrom = true;
SWEP.FiresUnderwater = true;

SWEP.Primary.Zap = false;
SWEP.Primary.ZapRadius = 150;
SWEP.Primary.ZapDamage = 3000;
SWEP.Primary.RPG = false
SWEP.Primary.RPGType = "bazooka_round"
SWEP.Primary.Sound = "weapons/railgun/railgun_fire1.wav"
SWEP.Primary.Tracer = 1;
SWEP.Primary.Automatic = false;
SWEP.Primary.Force = 9999;
SWEP.Primary.FireFromHip = true;
SWEP.Primary.Weld = false;
SWEP.Primary.Ammo = "pistol";
SWEP.Primary.ExplosionShot = false;
SWEP.Primary.BulletShot = true;
SWEP.Primary.ModelShot = false;
SWEP.Primary.BreakAll = false;
SWEP.Primary.Ignite = false;
SWEP.Primary.ClipSize = 9999;
SWEP.Primary.DefaultClip = 9999;
SWEP.Primary.Recoil = 0;
SWEP.Primary.Damage = 9999;
SWEP.Primary.NumberofShots = 1;
SWEP.Primary.Spread = 0.1;
SWEP.Primary.Delay = 0.1;
SWEP.Primary.Model = "models/props_c17/FurnitureChair001a.mdl";
SWEP.Primary.ExplosionSound = "weapon_AWP.Single";
SWEP.Primary.ExplosionSoundDistance = 400;
SWEP.Primary.ExplosionSize = 175;
SWEP.Primary.TakeAmmo = 1;

SWEP.Secondary.RPG = false
SWEP.Secondary.RPGType = "bazooka_round"
SWEP.Secondary.Sound = "weapons/railgun/railgun_fire1.wav"
SWEP.Secondary.Tracer = 1;
SWEP.Secondary.Force = 9999;
SWEP.Secondary.Automatic = true;
SWEP.Secondary.FireFromHip = true;
SWEP.Secondary.Weld = false;
SWEP.Secondary.ExplosionShot = false;
SWEP.Secondary.BulletShot = true;
SWEP.Secondary.ModelShot = false;
SWEP.Secondary.BreakAll = false;
SWEP.Secondary.Zap = false;
SWEP.Secondary.ZapRadius = 150;
SWEP.Secondary.ZapDamage = 3000;
SWEP.Secondary.Ignite = false;
SWEP.Secondary.Recoil = 0;
SWEP.Secondary.Spread = 0.1;
SWEP.Secondary.Delay = 0;
SWEP.Secondary.Automatic = true;
SWEP.Secondary.Sound = "weapons/railgun/railgun_fire1.wav";
SWEP.Secondary.TakeAmmo = 1;
SWEP.Secondary.Model = "models/props_c17/FurnitureChair001a.mdl";
SWEP.Secondary.ExplosionSound = "weapon_AWP.Single";
SWEP.Secondary.ExplosionSoundDistance = 400;
SWEP.Secondary.ExplosionSize = 175;

function SWEP:Initialize()
    util.PrecacheSound(self.Primary.Sound);
    util.PrecacheSound(self.Secondary.Sound);
    if ( SERVER ) then
       self:SetWeaponHoldType( self.HoldType );
   end
end

function SWEP:PrimaryAttack()
   if ( !self:CanPrimaryAttack() ) then return end

//Default stuff, normally used in any condition.
   local tr = self.Owner:GetEyeTrace();
   self.Weapon:EmitSound ( self.Primary.Sound );
   self:ShootEffects();
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay );
   self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay );   self:TakePrimaryAmmo(self.Primary.TakeAmmo);
   local rnda = -self.Primary.Recoil;
   local rndb = self.Primary.Recoil * math.random(-1, 1);
   self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) );

//The attack mode, can vary from the user settings
    if ( self.Primary.ModelShot ) then
    if (!SERVER) then return end;
    local ent = ents.Create ("prop_physics");
    ent:SetModel ( self.Primary.Model );
    if ( self.Primary.FireFromHip ) then
        ent:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector() * 32));
    else
        ent:SetPos (tr.HitPos + self.Owner:GetAimVector() * -16);
    end
    ent:SetAngles (self.Owner:EyeAngles());
    ent:Spawn();
    local phys = ent:GetPhysicsObject();
    local shot_length = tr.HitPos:Length();
    if ( self.Primary.Weld ) then
        local weld = constraint.Weld( tr.Entity, ent, tr.PhysicsBone, 0, 0 );
    end
    phys:ApplyForceCenter (self.Owner:GetAimVector():GetNormalized() * math.pow (shot_length, 3));
    cleanup.Add (self.Owner, "props", ent);
    undo.Create ("Thrown model");
    undo.AddEntity (ent);
    undo.SetPlayer (self.Owner);
    undo.Finish();
end    if ( self.Primary.BulletShot ) then
        local bullet = {};
        bullet.Num = self.Primary.NumberofShots;
        bullet.Src = self.Owner:GetShootPos();
        bullet.Dir = self.Owner:GetAimVector();
        bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0);
        bullet.Tracer = self.Primary.Tracer;
        bullet.Force = self.Primary.Force;
        bullet.Damage = self.Primary.Damage;
        bullet.AmmoType = self.Primary.Ammo;
        self.Owner:FireBullets( bullet );
    end
   if ( self.Primary.ExplosionShot ) then
       local explode = ents.Create( "env_explosion" );
       explode:SetPos( tr.HitPos );
       explode:SetOwner( self.Owner );
       explode:Spawn();
       explode:SetKeyValue( "iMagnitude", self.Primary.ExplosionSize );
       explode:Fire( "Explode", 0, 0 );
       explode:EmitSound( self.Primary.ExplosionSound, self.Primary.ExplosionSoundDistance, self.Primary.ExplosionSoundDistance );
    end
    if ( self.Primary.BreakAll ) then
        if( tr.Entity:IsValid() and tr.Entity:GetClass() == "prop_physics" ) then
            constraint.RemoveAll( tr.Entity );
            local physobject = tr.Entity:GetPhysicsObject();
            physobject:EnableMotion( true );
            physobject:SetVelocity( self.Owner:GetAimVector() * 2 );
        end
    end
if ( self.Primary.Zap ) then
   local vaporize = ents.Create ( "point_hurt" )
   vaporize:SetKeyValue ( "DamageRadius", self.Primary.ZapRadius )
   vaporize:SetKeyValue ( "Damage" , self.Primary.ZapDamage )
   vaporize:SetKeyValue ( "DamageDelay", 0 )
   vaporize:SetKeyValue ( "DamageType" ,"67108864" )
   vaporize:SetPos ( tr.HitPos )
   vaporize:Fire ( "TurnOn" , "", 0 )
   vaporize:Fire ( "TurnOff" , "", 0.5 )
end
if ( self.Primary.RPG ) then
    local shotpos = self.Owner:GetShootPos()
    shotpos = shotpos + self.Owner:GetForward() * 0
    shotpos = shotpos + self.Owner:GetRight() * 10
    shotpos = shotpos + self.Owner:GetUp() * -6
    local rocket = ents.Create("hl2_rocket")
    if (ValidEntity(rocket)) then
        rocket:SetPos(shotpos)
        rocket:SetOwner(self.Owner)
     rocket:Spawn()
    rocket.Owner = self.Owner
local TF2Rocket = ents.Create("prop_dynamic")
    if (ValidEntity(TF2Rocket)) then
    TF2Rocket:SetPos(shotpos)
    TF2Rocket:SetModel( "models/weapons/w_missile.mdl" )
    TF2Rocket:Spawn()
   TF2Rocket:SetParent(rocket)
end

    local b = ents.Create( "info_target" )
    if (ValidEntity(b)) then
    b:SetPos( self.Owner:GetEyeTrace( ).HitPos + Vector(0,0,0))
    b:Spawn( )
    rocket:PointAtEntity( b )
    b:Remove( )
end
end
end
    if ( self.Primary.Ignite ) then
        if (!tr.Entity) then return false end
        if (!tr.Entity:IsValid() ) then return false end
        if (tr.Entity:IsPlayer()) then return false end
        if (tr.Entity:IsWorld()) then return false end
        if ( CLIENT ) then return true end
        local Time = math.random(20);
        tr.Entity:Extinguish();
        tr.Entity:Ignite( Time, 0 );
    end

end

function SWEP:SecondaryAttack()
   if ( !self:CanPrimaryAttack() ) then return end

//Default stuff, normally used in any condition.
   local tr = self.Owner:GetEyeTrace();
   self.Weapon:EmitSound ( self.Secondary.Sound );
   self:ShootEffects();
   self.Weapon:SetNextPrimaryFire( CurTime() + self.Secondary.Delay );
   self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay );
   self:TakePrimaryAmmo(self.Secondary.TakeAmmo);
   local rnda = -self.Secondary.Recoil;
   local rndb = self.Secondary.Recoil * math.random(-1, 1);
   self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) );

//The attack mode, can vary from the user settings
if ( self.Secondary.ModelShot ) then
    if (!SERVER) then return end
    local ent = ents.Create ("prop_physics");
    ent:SetModel ( self.Secondary.Model );
    if ( self.Secondary.FireFromHip ) then
        ent:SetPos (self.Owner:EyePos() + (self.Owner:GetAimVector() * 32));
    else
        ent:SetPos (tr.HitPos + self.Owner:GetAimVector() * -16);
    end
    ent:SetAngles (self.Owner:EyeAngles());
    ent:Spawn();
    local phys = ent:GetPhysicsObject();
    local shot_length = tr.HitPos:Length();
    if ( self.Secondary.Weld ) then
        local weld = constraint.Weld( tr.Entity, ent, tr.PhysicsBone, 0, 0 );
    end
    phys:ApplyForceCenter (self.Owner:GetAimVector():GetNormalized() * math.pow (shot_length, 3));
    cleanup.Add (self.Owner, "props", ent);
    undo.Create ("Thrown model");
    undo.AddEntity (ent);
    undo.SetPlayer (self.Owner);
    undo.Finish();
end     if (self.Secondary.BulletShot ) then
   local bullet = {};
       bullet.Num = self.Secondary.NumberofShots;
       bullet.Src = self.Owner:GetShootPos();
       bullet.Dir = self.Owner:GetAimVector();
       bullet.Spread = Vector( self.Secondary.Spread * 0.1 , self.Secondary.Spread * 0.1, 0);
       bullet.Tracer = self.Secondary.Tracer;
       bullet.Force = self.Secondary.Force;
       bullet.Damage = self.Secondary.Damage;
       bullet.AmmoType = self.Primary.Ammo;
   self.Owner:FireBullets( bullet );
end
if ( self.Secondary.Zap ) then
   local vaporize = ents.Create ( "point_hurt" )
   vaporize:SetKeyValue ( "DamageRadius", self.Secondary.ZapRadius )
   vaporize:SetKeyValue ( "Damage" , self.Secondary.ZapDamage )
   vaporize:SetKeyValue ( "DamageDelay", 0 )
   vaporize:SetKeyValue ( "DamageType" ,"67108864" )
   vaporize:SetPos ( tr.HitPos )
   vaporize:Fire ( "TurnOn" , "", 0 )
   vaporize:Fire ( "TurnOff" , "", 0.5 )
end
if ( self.Secondary.ExplosionShot ) then
   local explode = ents.Create( "env_explosion" );
   explode:SetPos( tr.HitPos );
   explode:SetOwner( self.Owner );
   explode:Spawn();
   explode:SetKeyValue( "iMagnitude", self.Secondary.ExplosionSize );
   explode:Fire( "Explode", 0, 0 );
   explode:EmitSound( self.Secondary.ExplosionSound, self.Secondary.ExplosionSoundDistance, self.Secondary.ExplosionSoundDistance );
end
   if ( self.Secondary.BreakAll ) then
       if( tr.Entity:IsValid() and tr.Entity:GetClass() == "prop_physics" ) then
           constraint.RemoveAll( tr.Entity );
           local physobject = tr.Entity:GetPhysicsObject();
           physobject:EnableMotion( true );
           physobject:SetVelocity( self.Owner:GetAimVector() * 2 );
       end
   end
    if ( self.Secondary.RPG ) then
    local shotpos = self.Owner:GetShootPos()
    shotpos = shotpos + self.Owner:GetForward() * 0
    shotpos = shotpos + self.Owner:GetRight() * 10
    shotpos = shotpos + self.Owner:GetUp() * -6
    local rocket = ents.Create("hl2_rocket")
    if (ValidEntity(rocket)) then
        rocket:SetPos(shotpos)
        rocket:SetOwner(self.Owner)
     rocket:Spawn()
    rocket.Owner = self.Owner
local TF2Rocket = ents.Create("prop_dynamic")
    if (ValidEntity(TF2Rocket)) then
    TF2Rocket:SetPos(shotpos)
    TF2Rocket:SetModel( "models/weapons/w_missile.mdl" )
    TF2Rocket:Spawn()
   TF2Rocket:SetParent(rocket)
end

local effectdata = EffectData()
effectdata:SetOrigin( trace.HitPos )
effectdata:SetStart( self.Owner:GetShootPos() )
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Weapon )
util.Effect( "ToolTracer", effectdata )
if (SERVER) then
    local owner=self.Owner
if self.Owner.SENT then
    owner=self.Owner.SENT.Entity
end

    local b = ents.Create( "info_target" )
    if (ValidEntity(b)) then
    b:SetPos( self.Owner:GetEyeTrace( ).HitPos + Vector(0,0,0))
    b:Spawn( )
    rocket:PointAtEntity( b )
    b:Remove( )
end
end
end
if ( self.Secondary.Ignite ) then
    if (!tr.Entity) then return false end
        if (!tr.Entity:IsValid() ) then return false end
        if (tr.Entity:IsPlayer()) then return false end
        if (tr.Entity:IsWorld()) then return false end
        if ( CLIENT ) then return true end
        local Time = math.random(20);
        tr.Entity:Extinguish();
        tr.Entity:Ignite( Time, 0 );    end
end

function SWEP:TakePrimaryAmmo( num )
    
    // Doesn't use clips
    if ( self.Weapon:Clip1() <= 0 ) then 
        if ( self:Ammo1() <= 0 ) then return end    
        self.Owner:RemoveAmmo( num, self.Weapon:GetPrimaryAmmoType() )
    return end
    self.Weapon:SetClip1( self.Weapon:Clip1() - num )    
end


function SWEP:TakeSecondaryAmmo( num )
    
    // Doesn't use clips
    if ( self.Weapon:Clip2() <= 0 ) then 
    
        if ( self:Ammo2() <= 0 ) then return end
        
        self.Owner:RemoveAmmo( num, self.Weapon:GetSecondaryAmmoType() )
    
    return end
    
    self.Weapon:SetClip2( self.Weapon:Clip2() - num )    
    

function SWEP:Think()
end

function SWEP:Reload()
   self.Weapon:DefaultReload(ACT_VM_RELOAD);
end

function SWEP:Deploy()
   self.Weapon:SendWeaponAnim(ACT_VM_DRAW);
   return true
end

function SWEP:Holster()
   return true
end

function SWEP:OnRemove()
end

function SWEP:OnRestore()
end

function SWEP:Precache()
end

function SWEP:OwnerChanged()
end

And it’s not showing up, even when It was before!

I’m planning on putting them on Gmod.org once they’re finished, So I kind of need to know why they aren’t appearing. I am also not getting ANY LUA errors either.

And while I’m at it, how would you set it to infinite ammo?

EDIT: here is what it says when I say give shock_pistol:

give shock_pistol
Attempted to create unknown entity type shock_pistol!
NULL Ent in GiveNamedItem!

DO NOT COPY THE FIXED CODE AND CLAIM IT AS YOUR OWN TO UPLOAD, IF YOU DO, YOU ARE LAZY, STUPID, AND YOU LIVE IN YOUR MOTHERS BASEMENT!

use lua brackets please, and this is not the right section, post this in lua<newbie questions

I can’t move a thread, Can I? If there are two things I’m new to, they’re coding and forums!