Merge pull request #15 from Arkshine/fix-cs-spectator-issue
CS: Fix spectator team index not being set in specific situation
This commit is contained in:
commit
c0e3509e65
|
@ -112,6 +112,20 @@ void Client_TeamInfo(void* mValue)
|
||||||
g_players[index].team.assign(msg);
|
g_players[index].team.assign(msg);
|
||||||
g_teamsIds.registerTeam(msg, -1);
|
g_teamsIds.registerTeam(msg, -1);
|
||||||
g_players[index].teamId = g_teamsIds.findTeamId(msg);
|
g_players[index].teamId = g_teamsIds.findTeamId(msg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CS fix for SPECTATOR team.
|
||||||
|
* -
|
||||||
|
* When a player chooses spectator, ScoreInfo is sent before TeamInfo and with 0 as index.
|
||||||
|
* This means for the first round of first spectator, SPECTATOR name is not associated with its index.
|
||||||
|
* The following fix manually sets the team index when we hit SPECTATOR team.
|
||||||
|
*/
|
||||||
|
if (g_players[index].teamId == -1 && g_bmod_cstrike && !strcmp(msg, "SPECTATOR"))
|
||||||
|
{
|
||||||
|
g_players[index].teamId = 3;
|
||||||
|
g_teamsIds.registerTeam(msg, 3);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1761,8 +1761,14 @@ int MNF_SetPlayerTeamInfo(int player, int teamid, const char *teamname)
|
||||||
|
|
||||||
pPlayer->teamId = teamid;
|
pPlayer->teamId = teamid;
|
||||||
if (teamname != NULL)
|
if (teamname != NULL)
|
||||||
|
{
|
||||||
pPlayer->team.assign(teamname);
|
pPlayer->team.assign(teamname);
|
||||||
|
|
||||||
|
// Make sure team is registered, otherwise
|
||||||
|
// natives relying on team id will return wrong result.
|
||||||
|
g_teamsIds.registerTeam(teamname, teamid);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user