bool g_bMovedAfterJoin[MAXPLAYERS + 1] = {true, ...};
public void OnClientConnected(int client)
{
g_bMovedAfterJoin[client] = false;
}
public void Event_player_team(Event event, const char[] name, bool dontBroadcast)
{
int userid = event.GetInt("userid");
int client = GetClientOfUserId(userid);
if(!g_bMovedAfterJoin[client] && client)
{
g_bMovedAfterJoin[client] = true;
if (event.GetInt("team") != 3) {
RequestFrame(MovedAfterJoin, userid);
}
}
}
public void MovedAfterJoin(any data)
{
int client = GetClientOfUserId(view_as<int>(data));
if (client && IsClientInGame(client)) {
ChangeClientTeam(client, 3);
}
}
public void OnPluginStart()
{
HookEvent("player_team", Event_player_team, EventHookMode_Post);
}