alright so i created my own gmod swep and everything works but the sound for some reason it could be primary attacked is messed up but it doesn't cause any lua errors here is the code maybe you guys could tell me what's wrong with it
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
SWEP.HoldType = "fist"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false;
SWEP.AutoSwitchFrom = false;
end
if ( CLIENT ) then
SWEP.PrintName = "Are you my mummy Swep"
SWEP.Author = "Not A Minge"
SWEP.Contact = "Not a Minge"
SWEP.Purpose = "you find mama"
--SWEP.Instructions = ""
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
--SWEP.HoldType = "normal"
SWEP.Slot = 0
SWEP.SlotPos = 1
SWEP.IconLetter = "C"
SWEP.ViewModelFOV = 0
SWEP.Category = "Mommy"
SWEP.DrawCrosshair = false
--SWEP.ViewModelFOV = 65
--SWEP.ViewModelFlip = false
--SWEP.ViewModel = ""
--SWEP.WorldModel = ""
end
x = 0
function SWEP:Think()
end
function SWEP:Initialize()
end
function SWEP:PrimaryAttack()
--BITE
if x==0 then
self.Weapon:SetNextPrimaryFire(CurTime() + .75)
self.Owner:LagCompensation( true )
local trace = self.Owner:GetEyeTrace()
if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then
bullet = {}
bullet.Num = 1
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector(0, 0, 0)
bullet.Tracer = 0
bullet.Force = 8
bullet.Damage = 20
self.Owner:FireBullets(bullet)
self.Owner:LagCompensation( false )
self.Weapon:EmitSound("crying/mummy.wav")
else
self.Owner:LagCompensation( false )
self.Weapon:EmitSound("crying/areyoumymummy.wav")
end
elseif x==1 then
self.Weapon:SetNextPrimaryFire(CurTime() + 1)
self.Weapon:EmitSound("crying/mummy.wav")
elseif x==2 then
self.Weapon:SetNextPrimaryFire(CurTime() + 1)
self.Weapon:EmitSound("crying/areyoumymummy.wav")
end
end
function SWEP:SecondaryAttack()
if x==0 then
x=1
self.Owner:ChatPrint("MAMA")
elseif x==1 then
x=2
self.Owner:ChatPrint("Waaaaaaaaahwaaaaaaa")
end
end
function SWEP:Deploy()
self.Owner:DrawViewModel(false)
self.Owner:DrawWorldModel(false)
return true
end
function SWEP:Holster()
return true
end
function SWEP:DoImpactEffect( tr, dmgtype )
return true
end
-------------------------------------------------------------------
SWEP.Author = "Not A Minge"
SWEP.Contact = ""
SWEP.Purpose = "You find mama"
SWEP.Instructions = "Left click with your mouse to scream for mama"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
-----------------------------------------------
SWEP.FiresUnderwater = true
SWEP.HoldType = "ar2"
SWEP.ViewModel = "models/weapons/v_hands.mdl"--""
SWEP.WorldModel = ""--"w_hands.mdl"
-----------------------------------------------
SWEP.Primary.Delay = 0.3
SWEP.Primary.Sound = Sound( "crying/mummy.wav" )
SWEP.Primary.Recoil = 0
SWEP.Primary.Damage = 15
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
-------------------------------------------------
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.Sound = Sound( "crying/areyoumymummy.wav" )
SWEP.Secondary.Delay = 1.75
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
-------------------------------------------------
[editline]23rd March 2016[/editline]
actually this was in the console anybody know how to fix this *** Invalid sample rate (48000) for sound 'crying\areyoumymummy.wav'.
Tried searching? (No) You need to set the sample rate to 44100 in Audacity or something
[QUOTE=Coffeee;49990675]Tried searching? (No) You need to set the sample rate to 44100 in Audacity or something[/QUOTE]
yea ik thanks
Sorry, you need to Log In to post a reply to this thread.