[CODE]function SWEP:SecondaryAttack()
if (not IsValid(ply)) or ply:IsSuperAdmin() or ply:IsAdmin() or ply:IsUserGroup("moderator") or ply:IsUserGroup("member") or ply:IsUserGroup("vip") or ply:IsUserGroup("owner") then
self.Weapon:SetNextSecondaryFire( CurTime() + 1 )
local TauntSound = Sound( "siege/I'veGotaSuicideBomb.wav" )
self.Weapon:EmitSound( TauntSound ) else
return
end
end[/CODE]
Some how, every user can play this sound, instead of admin sadmin mod member or vip. Not the best at this ..
ply does not exist.
Since it does not exist, "not IsValid(ply)" is true and this condition passes:
[lua]if (not IsValid(ply)) or ply:IsSuperAdmin() or ply:IsAdmin() or ply:IsUserGroup("moderator") or ply:IsUserGroup("member") or ply:IsUserGroup("vip") or ply:IsUserGroup("owner") then[/lua]
You need to define ply. In your case, I guess it's supposed to be the owner of the weapon. So you'll need to add "local ply = self:GetOwner()" at the beginning of your function.
Also remove the "not IsValid(ply)" check, it does not make sense. If the weapon has no owner, why would it be able to fire its secondary attack by itself?
[lua]function SWEP:SecondaryAttack()
local ply = self:GetOwner()
if ply:IsSuperAdmin() or ply:IsAdmin() or ply:IsUserGroup("moderator") or ply:IsUserGroup("member") or ply:IsUserGroup("vip") or ply:IsUserGroup("owner") then
self.Weapon:SetNextSecondaryFire( CurTime() + 1 )
local TauntSound = Sound( "siege/I'veGotaSuicideBomb.wav" )
self.Weapon:EmitSound( TauntSound ) else
return
end
end[/lua]
Thank you killburn so stupid i forgot that...
Sorry, you need to Log In to post a reply to this thread.