Hey, guys.
I am trying to make auto npc corpses cleaner.
But i have problems :\
So, i am tried to use two my codes
For your first code, just check if the entity is alive, and also please localize your functions or don't assign them to variables - e.g.
[CODE]
if SERVER then
hook.Add( "Initialize", "NPCRemove", function()
timer.Create( "Clean", 5, 0, function()
for k,v in pairs(ents.FindByModel(models/stalkertnb1/boar1.mdl)) do
if v:Health() <= 0 then
v:Remove()
end
end
end )
end )
end
[/CODE]
I don't know about the second code, though.
[editline]21st November 2015[/editline]
Acutally, your second code may not be working because your function is global (and you could be overriding it with the first one). Change it to a different name or localize it and try it then.
And, your hook has the same name as the other one you did, when hooks are meant to have unique names to avoid getting overwritten.
Sorry, you need to Log In to post a reply to this thread.