You must check if the player is connected whenever you use set_task. Players can disconnect before the task ends.
Here your solution to prevent that error
PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#define PLUGIN "Spawn Heal"
#define VERSION "1.0"
#define AUTHOR "RedRobster"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn,"player","Spawn_Hook",1)
}
public Spawn_Hook(id)
{
set_task(1.0,"Heal_User",id,_,_,"a",5)
}
public Heal_User(id)
{
if(is_user_alive(id) && is_user_connected(id))
{
set_user_health(id,100)
}
else remove_task(id)
}
Plus why are you setting players' health to 100 five times ? If you want to make a spawn protection, it is very poor way.