Code:
/*
* simple spawnPlayer method. spawns player.
* credits:
* <a href="https://forums.alliedmods.net/showpost.php?p=678294&postcount=19" target="_blank" rel="noopener">https://forums.alliedmods.net/showpo...4&postcount=19</a>
*/
public spawnPlayer(id)
{
// Disconnected, already spawned, or switched to Spectator
if (!is_user_connected(id)
|| is_user_alive(id)
|| cs_get_user_team(id) == CS_TEAM_SPECTATOR
|| cs_get_user_team(id) == CS_TEAM_UNASSIGNED)
{
return;
}
// Try to spawn the player setting the appropiate dead flag and forcing a think
set_pev(id, pev_deadflag, DEAD_RESPAWNABLE);
dllfunc(DLLFunc_Think, id);
// Fix for Bots: DLLFunc_Think won't work on them,
// but DLLFunc_Spawn does the job without any bugs.
if (is_user_bot(id) && pev(id, pev_deadflag) == DEAD_RESPAWNABLE)
{
dllfunc(DLLFunc_Spawn, id);
}
}
I am using this one.
__________________