Modifying Addon Help

I replicated the DearSister V2 SWEP right down to the Lua, but changed the sound file and modified the Lua as to correspond with the new sound, but it is not working.

I modified the Lua to use the new sound, and put it under a new category.

Still nothing.

How can I get my SWEP to work?

And BTW I just got GMod 7 days ago, so yeah, I’m still new to everything.

Oh, and if you’re wondering, I edited the files with TextEdit (I’m running Parallels Desktop on my MacBook Pro).

The underlined areas indicate the issue. Don’t call it “your swep” if all you did was take an existing SWEP and attempt to give it a different sound. It’s proper etiquette to say you modified it for your own purposes, but give the author full credit, and not release it publicly.

As far as your issue, you’d have to post the code you modified, at the least. Nobody can tell what you did wrong via telepathy.

without seing the code I’d guess you’ve screwed up with the filepaths or filetype.

Gmod 7, are you sure? Unless you bought Garry’s Mod on steam we won’t be able to help you.

GMod, 7 days ago. Not GMod 7, days ago.

Oops. Don’t know why I read that. :smile: Otherwise yes please provide the code and any lua errors you might get including their state(client/server).

Well, yes, you’re right, but still, you know what I intend.

Here is the code:

[lua]
if (SERVER) then

AddCSLuaFile("shared.lua")

SWEP.HoldType = "pistol"

end

if ( CLIENT ) then

SWEP.PrintName		= "Dear Sister SWEP V2"			

SWEP.Author			= ".ISO"

SWEP.Slot			= 1

SWEP.SlotPos		= 4

SWEP.IconLetter		= "e"

SWEP.Instructions 	= "Sv_Cheats need to be 1"

SWEP.Purpose 		= "Special Movie effects for assassination";



killicon.AddFont( "weapon_ironsight_pistol", "HL2KillIcons", 	SWEP.IconLetter, Color( 255, 80, 0, 255 ) )

end

SWEP.Base = “weapon_ironsight_base”

SWEP.Spawnable = false

SWEP.AdminSpawnable = true

SWEP.ViewModel = “models/weapons/v_pist_deagle.mdl”

SWEP.WorldModel = “models/weapons/w_pist_deagle.mdl”

SWEP.ViewModelFlip = true

SWEP.DrawCrosshair = true;

SWEP.Weight = 3

SWEP.AutoSwitchTo = false

SWEP.AutoSwitchFrom = false

SWEP.ForceApply = 10

SWEP.TracerFreq = 1

SWEP.Primary.Sound = “weapons/DearSister.wav”

SWEP.Primary.Recoil = 6.0

SWEP.Primary.RecoilXRand = 1.5

SWEP.Primary.RecoilYRand = 0.1

SWEP.Primary.Damage = 99999

SWEP.Primary.Force = 1000

SWEP.Primary.NumShots = 1

SWEP.Primary.Cone = 0

SWEP.Primary.ClipSize = 6

SWEP.Primary.Delay = 0.5

SWEP.Primary.DefaultClip = 70

SWEP.Primary.Automatic = false

SWEP.Primary.Ammo = “357”

SWEP.Secondary.ClipSize = -1

SWEP.Secondary.DefaultClip = -1

SWEP.Secondary.Automatic = false

SWEP.Secondary.Ammo = “none”

SWEP.IronSightsPos = Vector( 5.15, -2, 2.6 )

SWEP.IronSightsAng = Vector( 0, 0, 0 )

function SWEP:PrimaryAttack()

if ( !self:CanPrimaryAttack() ) then return end

timer.Simple(0, game.ConsoleCommand, "host_timescale 0.03
")

timer.Simple(0.01, game.ConsoleCommand, "pp_motionblur 1
")

timer.Simple(1.05, game.ConsoleCommand, "pp_motionblur 0
")

timer.Simple(1.05, game.ConsoleCommand, "host_timescale 1
")

timer.Simple(0.35, function() self.Owner:DropWeapon(self.Owner:GetActiveWeapon()) end)

self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )

self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )



if ( !self:CanPrimaryAttack() ) then return end

self.Weapon:EmitSound( self.Primary.Sound )

self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone )

self:TakePrimaryAmmo( 1 )



self.Owner:ViewPunch( Angle( math.Rand(-self.Primary.RecoilXRand,-self.Primary.RecoilXRand) * self.Primary.Recoil, math.Rand(self.Primary.RecoilYRand,-self.Primary.RecoilYRand) *self.Primary.Recoil, 0 ) )

end

function SWEP:Think()

local trace = self.Owner:GetEyeTrace()

if self.Owner:Health() < 100 then

    self.Owner:SetHealth(self.Owner:Health()+1)

end

end
[/lua]

As opposed to the modified code:

[lua]
if (SERVER) then

AddCSLuaFile("shared.lua")

SWEP.HoldType = "pistol"

end

if ( CLIENT ) then

SWEP.PrintName		= "WARP 1.9 SWEP"			

SWEP.Author			= ".ISO"

SWEP.Slot			= 1

SWEP.SlotPos		= 4

SWEP.IconLetter		= "e"

SWEP.Instructions 	= "Sv_Cheats need to be 1"

SWEP.Purpose 		= "Special Movie effects for assassination";



killicon.AddFont( "weapon_ironsight_pistol", "HL2KillIcons", 	SWEP.IconLetter, Color( 255, 80, 0, 255 ) )

end

SWEP.Base = “weapon_ironsight_base”

SWEP.Spawnable = false

SWEP.AdminSpawnable = true

SWEP.ViewModel = “models/weapons/v_pist_deagle.mdl”

SWEP.WorldModel = “models/weapons/w_pist_deagle.mdl”

SWEP.ViewModelFlip = true

SWEP.DrawCrosshair = true;

SWEP.Weight = 3

SWEP.AutoSwitchTo = false

SWEP.AutoSwitchFrom = false

SWEP.ForceApply = 10

SWEP.TracerFreq = 1

SWEP.Primary.Sound = “weapons/warp.wav”

SWEP.Primary.Recoil = 6.0

SWEP.Primary.RecoilXRand = 1.5

SWEP.Primary.RecoilYRand = 0.1

SWEP.Primary.Damage = 99999

SWEP.Primary.Force = 1000

SWEP.Primary.NumShots = 1

SWEP.Primary.Cone = 0

SWEP.Primary.ClipSize = 6

SWEP.Primary.Delay = 0.5

SWEP.Primary.DefaultClip = 70

SWEP.Primary.Automatic = false

SWEP.Primary.Ammo = “357”

SWEP.Secondary.ClipSize = -1

SWEP.Secondary.DefaultClip = -1

SWEP.Secondary.Automatic = false

SWEP.Secondary.Ammo = “none”

SWEP.IronSightsPos = Vector( 5.15, -2, 2.6 )

SWEP.IronSightsAng = Vector( 0, 0, 0 )

function SWEP:PrimaryAttack()

if ( !self:CanPrimaryAttack() ) then return end

timer.Simple(0, game.ConsoleCommand, "host_timescale 0.03
")

timer.Simple(0.01, game.ConsoleCommand, "pp_motionblur 1
")

timer.Simple(1.05, game.ConsoleCommand, "pp_motionblur 0
")

timer.Simple(1.05, game.ConsoleCommand, "host_timescale 1
")

timer.Simple(0.35, function() self.Owner:DropWeapon(self.Owner:GetActiveWeapon()) end)

self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )

self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )



if ( !self:CanPrimaryAttack() ) then return end

self.Weapon:EmitSound( self.Primary.Sound )

self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone )

self:TakePrimaryAmmo( 1 )



self.Owner:ViewPunch( Angle( math.Rand(-self.Primary.RecoilXRand,-self.Primary.RecoilXRand) * self.Primary.Recoil, math.Rand(self.Primary.RecoilYRand,-self.Primary.RecoilYRand) *self.Primary.Recoil, 0 ) )

end

function SWEP:Think()

local trace = self.Owner:GetEyeTrace()

if self.Owner:Health() < 100 then

    self.Owner:SetHealth(self.Owner:Health()+1)

end

end
[/lua]

Use [noparse][lua][/lua][/noparse] tags please.

There.

Then either the sound isn’t there, or you haven’t sent it. Are you doing this on singleplayer or multiplayer?

Singleplayer. And what do you mean by ‘sending’ it?

**[Resource.AddFile

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Resource.AddFile)**

But that’s unrelated now.

Are you sure the sound is there? Go to “Steam/steamapps/username/garrysmod/garrysmod/sound/weapons/” and see if warp.wav is actually in there.

It wasn’t, but I added it in.

But the original DearSister sound isn’t there either, and it works properly.

Still, the real problem is that it doesn’t show up under my weapons menu at all.

When you spawn open the console and scroll up. There will be a lua error related to your script which should help you pinpoint the problem.

No error related to it in the console. I checked earlier.

There are 3 possible reasons your script would not appear in the list :
1 - It contains a lua error (usually serverside)
2 - It has be configured not to appear in that list.
3 - The file is not at the right place.