Hey guys im making a entity turret and when it kills someone it says "sent_vt killed "player""
how can i make it so the killers name is the entitys owner
heres my code so far
function ENT:FireShot()
if ( self.NextShot > CurTime() ) then return end
self.NextShot = CurTime() + self.Delay
local bullet = {}
bullet.Num = self:GetNWInt("BN")
bullet.Src = self:GetPos()
bullet.Dir = self:GetNWVector("Pos") - self:GetPos()
bullet.Spread = self:GetNWVector("Spread")
bullet.Tracer = 1
bullet.Force = 5
bullet.Damage = self:GetNWInt("Damage")
bullet.Attacker = self.Owner
self.Entity:FireBullets( bullet )
end
[editline]09:56PM[/editline]
Anyone?
[highlight](User was banned for this post ("Wrong forum" - mahalis))[/highlight]
on the 2nd to last line, change self.Entity:FireBullets(bullet) to self.Owner:FireBullets(bullet). So it would be like the spawner shot the bullet but its coming from the turret so the killer would show up as the owner.
I think.
[QUOTE=cheesylard;16052088]on the 2nd to last line, change self.Entity:FireBullets(bullet) to self.Owner:FireBullets(bullet). So it would be like the spawner shot the bullet but its coming from the turret so the killer would show up as the owner.
I think.[/QUOTE]
Yes.
Or, you could set the owner of the turret to the player, but that would mean the player would nocollide with it and not be able to move it I think. You could do SetPhysicsAttacker, but it would just be easier to do like you said and fire the bullets from the owner.
Sorry, you need to Log In to post a reply to this thread.