Hello, I've recently been trying to create a zombie plague style plugin for Day of Defeat.
I'm trying to make it so when an Allied player dies he will instantly be switched to Axis and respawn and moved to his last position.
But for some reason when I try to respawn the player after death it is unable to do it.
Even after creating a task with 'set_task' to try and respawn the player after the death animation it just won't work.
Is there a potential fix for this? Or would I have to settle for a timed respawn
Code:
public plugin_init()
{
RegisterHam(Ham_Killed, "player", "Ham_OnKilled_Post");
}
public Ham_OnKilled_Post(id, killer)
{
new Float:value;
new string[MAX_STRING];
//pev_deadflag of 'id' is 0 (DEAD_NO)
if( get_user_team(id) == TEAM_HUMANS ) {
new deathpos[3];
get_user_origin(id, deathpos);
dod_set_user_team(id, 2, 0);
set_pev(id, pev_deadflag, DEAD_RESPAWNABLE);
//pev_deadflag of 'id' is 3 (DEAD_RESPAWNABLE)
DispatchSpawn(id);
set_user_origin(id, deathpos);
}
}