Hello, I try to send a player to spectator when he joins, however when I do so they get sent into a "limbo" state, unable to do anything. (origin 0,0,0 - camera tilted as if they were dead)
Code:
public player_spawn_pre(id)
{
if(g_bRoundStarted || get_playersnum() < 2)
{
hl_set_user_spectator(id, true);
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
If I send them to spectator again when they are killed (assuming they spawned normally), they go to spectator without problems.
Code:
public player_killed_post(id)
{
[...]
if (g_bRoundStarted)
set_task(5.0, "send_player_to_spec", id + TASK_SENDVICTIMTOSPEC);
}
Code:
public send_player_to_spec(taskid)
{
new id = taskid - TASK_SENDVICTIMTOSPEC;
if (is_user_connected(id))
{
if (!is_user_alive(id) || is_user_bot(id))
hl_set_user_spectator(id, true);
}
}
What's the cause of this?
EDIT: Fixed it myself by moving this operation to a task set on post
__________________