This is what I use on my server.
Doesn't detect spectator change, you'll have to add that separately.
Code:
#include <amxmodx>
#include <hamsandwich>
public plugin_init()
{
RegisterHam(Ham_Killed, "player", "fwd_HamKilled");
}
public fwd_HamKilled(Victim, Attacker, Shouldgib)
set_task(1.0, "RespawnPlayer", Victim);
public RespawnPlayer(id)
{
if ( ! is_user_connected(id) )
return;
ExecuteHamB(Ham_Spawn, id);
}
__________________