I am currently trying to modify a SWEP. The swep is the jumper powers swep by RonanDex. I am trying to modify it to emit a sound when you press reload, primary or secondary. The sounds are from Ultras RailGun, the names have been changed to make it easier to remember. I do not have any folders other than the lua and its subfolders. I am new to LUA and my swep is not even appearing in the swep list. Here is the shared.lua:
SWEP.PrintName = "Jump swep"
SWEP.Author = "Megatron712"
SWEP.Instructions = "Use Primary trigger to jump to what you are looking at. Secondary fire goes to the most recent jump location. Reload to create the jump location. Sounds are from Ultras RailGun. Base is from Jumper Powers by RonanDex"
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = true
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.ViewModel = ""
SWEP.WorldModel = ""
SWEP.Primary.Sound = Sound( "teleport.wav" )
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
Swep.Secondary.Sound = Sound( "jump.wav" )
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
JumpSet = false;
JumpSite = Vector(nil);
function SWEP:Reload()
local ply = self.Owner
if ply:GetPos() != SavedPos then
JumpSet = true
JumpSite = ply:GetPos()
local vPoint = JumpSite
ply:PrintMessage(HUD_PRINTTALK, "Jump location created.")
self.Weapon:EmitSound("ambient/wind/wind_hit2.wav")
return
end
end
function SWEP:PrimaryAttack( tr )
local ply = self.Owner
local t = {}
t.start = ply:GetPos() + Vector( 0, 0, 32 )
t.endpos = ply:GetPos() + ply:EyeAngles():Forward() * 16384
t.filter = ply
self.Weapon:EmitSound("teleport.wav")
local tr = util.TraceEntity( t, ply )
ply:SetPos( tr.HitPos )
end
end
function SWEP:SecondaryAttack()
local ply = self.Owner
local pos = ply:GetPos()
if JumpSet == false then
ply:PrintMessage(HUD_PRINTTALK, "There is no created Jump location.")
return
end
if pos != JumpSite then
ply:SetPos(JumpSite)
pos = ply:GetPos()
self.Weapon:EmitSound("jump.wav")
return
end
If I am missing anything just let me know.