"Cleanly" removing an entity.
Instead of creating timers (createTimer) to remove an entity this just fires the kill event from the entity's event queue. Using this you don't have to have a separate timer doing multiple checks on the entity when you want to remove it.
I saw something like this implemented in a plugin long time ago and forgot which one it was.
PHP Code:
public killEntityIn(entity, Float:seconds)
{
if(IsValidEdict(entity))
{
// send "kill" event to the event queue
new String:addoutput[64];
Format(addoutput, sizeof(addoutput), "OnUser1 !self:kill::%f:1",seconds);
SetVariantString(addoutput);
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
}
}
__________________