Server-side check for chooseteam event calls, to avoid a NULL pointer error

when someone tries to execute these functions with a modified client.
This commit is contained in:
Marco Cawthorne 2021-08-13 22:06:28 +02:00
parent 136a4060b7
commit 40f7a76c1d
1 changed files with 18 additions and 3 deletions

View File

@ -987,8 +987,16 @@ Event Handling, called by the Client codebase via 'sendevent'
void
CSEv_JoinTeam_f(float flChar)
{
CSMultiplayerRules rules = (CSMultiplayerRules)g_grMode;
player pl = (player)self;
CSMultiplayerRules rules;
player pl;
/* matches Game_InitRules() */
if (cvar("sv_playerslots") == 1 || cvar("coop") == 1) {
return;
}
rules = (CSMultiplayerRules)g_grMode;
pl = (player)self;
if (pl.team == TEAM_VIP) {
centerprint(pl, "You are the VIP!\nYou cannot switch roles now.\n");
@ -1054,7 +1062,14 @@ CSEv_JoinTeam_f(float flChar)
void
CSEv_JoinAuto(void)
{
CSMultiplayerRules rules = (CSMultiplayerRules)g_grMode;
CSMultiplayerRules rules;
/* matches Game_InitRules() */
if (cvar("sv_playerslots") == 1 || cvar("coop") == 1) {
return;
}
rules = (CSMultiplayerRules)g_grMode;
rules.CountPlayers();
if (g_cs_total_ct >= g_cs_total_t) {