• Weapon not Working
    1 replies, posted
Whenever I try to create the weapon it says it's not valid, I'm guessing it has something to do with the Trace.getmodel part, because Once I added that It stopped working, any Ideas? [code]function SWEP:PrimaryAttack() if !self.NextStrike then self.NextStrike = 0 end if( CurTime() < self.NextStrike ) then return; end self.Owner:SetAnimation( PLAYER_ATTACK1 ) self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) if SERVER then local trace = self.Owner:GetEyeTrace() if trace.HitPos:Distance( self.Owner:GetShootPos() ) <= 75 and trace.HitNonWorld and trace.Entity:GetModel() == "models/props_canal/boat001a.mdl") then self.Owner:EmitSound( "physics/wood/wood_box_impact_bullet"..math.random( 1,4 )..".wav" ) _G.CAKE.CreateItem( "ration", self.Owner:CalcDrop( ), Angle( 0,0,0 ) ); end end self.NextStrike = ( CurTime() + 0.5 ) end[/code]
Try this: [code] function SWEP:PrimaryAttack() if !self.NextStrike then self.NextStrike = 0 end if( CurTime() < self.NextStrike ) then return; end self.Owner:SetAnimation( PLAYER_ATTACK1 ) self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) if SERVER then local trace = self.Owner:GetEyeTrace() if trace.HitPos:Distance( self.Owner:GetShootPos() ) <= 75 and trace.HitNonWorld and trace.Entity:GetModel() == "models/props_canal/boat001a.mdl" then self.Owner:EmitSound( "physics/wood/wood_box_impact_bullet"..math.random( 1,4 )..".wav" ) _G.CAKE.CreateItem( "ration", self.Owner:CalcDrop( ), Angle( 0,0,0 ) ); end end self.NextStrike = ( CurTime() + 0.5 ) end [/code] Put it through a syntax checker, should now be kosher.
Sorry, you need to Log In to post a reply to this thread.