Probably because variable ent in KILL function is 0. To make it store entity index you need to set task like this:
PHP Code:
set_task(4.0, "KILL", ent)
Also in code you posted set_task is never executed, and you should check if ent is valid in KILL function before trying to remove it.
__________________