Quote:
Originally Posted by jonitaikaponi
Yeah. I've noticed that player's that get spawned without a valid team, spawn in the way you described. I guess what is happening here, is that the player gets spawned when he is on the spectator team or being changed to it.
Try to use ChangeClientTeam(client, team) before respawning the player.
1 = Spectate
2 = Terrorists
3 = Counter-Terrorists
|
Thanks for the suggestion, just tried it then using a flat ChangeClientTeam(client, 2), the team change goes ahead but I'm still in the floor. Very strange.
Code:
public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
{
int userID = GetEventInt(event, "userid");
int client = GetClientOfUserId(userID);
bool alive = IsPlayerAlive(client);
int team = GetClientTeam(client);
PrintToChat(client, "Alive: %b, Team: %d", alive, team);
if (!IsPlayerAlive(client)) {
ChangeClientTeam(client, 2);
CS_RespawnPlayer(client);
}
return Plugin_Continue;
}
Returns Alive: 0, Team: 3 (Counter Terrorists).