Its mostly the old SWEP turret code fixed to suit what I need.
Anyway, this does not retrieve any enemies, nor do the effects appear.
This code is also running completely serverside.
[lua]
local tr={};
tr.start=self.Entity:LocalToWorld(Vector(0,0,50))
tr.endpos=self:GetNWEntity("target"):LocalToWorld(self:GetNWEntity("target"):OBBCenter())
tr.filter=self.Entity
local trace = util.TraceLine( tr )
if (!trace.Hit) then return end
local hitpos = trace.HitPos
local effectdata = EffectData()
effectdata:SetOrigin( hitpos )
effectdata:SetStart( ap.Pos )
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Entity)
util.Effect( "flamer", effectdata )
if self.LastBall + 0.25 <= CurTime() then
local dmg = 10
local victims=ents.FindInCone(ap.Pos, self.FirePos-ap.Pos:Normalize(), 400, 90 )
for k,v in pairs(victims) do
[/lua]
Everything is defined as it should be.
you need to end the if and for loop with end
[lua]
local tr={};
tr.start=self.Entity:LocalToWorld(Vector(0,0,50))
tr.endpos=self:GetNWEntity("target"):LocalToWorld(self:GetNWEntity("target"):OBBCenter())
tr.filter=self.Entity
local trace = util.TraceLine( tr )
if (!trace.Hit) then return end
local hitpos = trace.HitPos
local effectdata = EffectData()
effectdata:SetOrigin( hitpos )
effectdata:SetStart( ap.Pos )
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Entity)
util.Effect( "flamer", effectdata )
if self.LastBall + 0.25 <= CurTime() then
local dmg = 10
local victims=ents.FindInCone(ap.Pos, self.FirePos-ap.Pos:Normalize(), 400, 90 )
for k,v in pairs(victims) do
end
end
[/lua]
but im not sure why you have a for loop that does nothing....
[QUOTE=gameguysz;32237566]you need to end the if and for loop with end
[lua]
local tr={};
tr.start=self.Entity:LocalToWorld(Vector(0,0,50))
tr.endpos=self:GetNWEntity("target"):LocalToWorld(self:GetNWEntity("target"):OBBCenter())
tr.filter=self.Entity
local trace = util.TraceLine( tr )
if (!trace.Hit) then return end
local hitpos = trace.HitPos
local effectdata = EffectData()
effectdata:SetOrigin( hitpos )
effectdata:SetStart( ap.Pos )
effectdata:SetAttachment( 1 )
effectdata:SetEntity( self.Entity)
util.Effect( "flamer", effectdata )
if self.LastBall + 0.25 <= CurTime() then
local dmg = 10
local victims=ents.FindInCone(ap.Pos, self.FirePos-ap.Pos:Normalize(), 400, 90 )
for k,v in pairs(victims) do
end
end
[/lua]
but im not sure why you have a for loop that does nothing....[/QUOTE]
I already fixed it, but forgot to edit the post. It was a snippit, anyway.
Turns out I was checking to see if a nil value was false, which would return non-erroring code.
Sorry, you need to Log In to post a reply to this thread.