Skip to content

Commit 2661419

Browse files
committed
Split gamemode winner into base group
Parse the winning gamemode string into a base group and extra subgroup before processing. The code now calls SplitGamemodeString and copies the base group into g_sVoteGameMode, and uses baseGroup for MMC_FindGameModeIndex, HasSubGroups checks, and StartCooldown calls. This prevents subgroup suffixes from interfering with game-mode lookups and vote/cooldown logic.
1 parent 3a77a67 commit 2661419

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

addons/sourcemod/scripting/multimode_core.sp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,13 +1377,17 @@ void HandleWinner(const char[] winner, VoteType voteType)
13771377
{
13781378
case VOTE_TYPE_GROUP:
13791379
{
1380-
strcopy(g_sVoteGameMode, sizeof(g_sVoteGameMode), winner);
1380+
char baseGroup[64];
1381+
char extraSub[64];
1382+
SplitGamemodeString(winner, baseGroup, sizeof(baseGroup), extraSub, sizeof(extraSub));
1383+
1384+
strcopy(g_sVoteGameMode, sizeof(g_sVoteGameMode), baseGroup);
13811385

13821386
bool isGroupsOnlyVote = (g_CurrentVoteConfig.type == VOTE_TYPE_GROUPS_ONLY);
13831387

13841388
if (isGroupsOnlyVote || GetVoteMethod() == 2)
13851389
{
1386-
int index = MMC_FindGameModeIndex(winner);
1390+
int index = MMC_FindGameModeIndex(baseGroup);
13871391
if (index != -1)
13881392
{
13891393
GameModeConfig config;
@@ -1440,15 +1444,15 @@ void HandleWinner(const char[] winner, VoteType voteType)
14401444
delete allMaps;
14411445
}
14421446
}
1443-
else if (HasSubGroups(winner))
1447+
else if (HasSubGroups(baseGroup))
14441448
{
14451449
g_bVoteActive = false;
1446-
StartCooldown(VOTE_TYPE_SUBGROUP, winner, "", g_iVoteInitiator);
1450+
StartCooldown(VOTE_TYPE_SUBGROUP, baseGroup, "", g_iVoteInitiator);
14471451
}
14481452
else
14491453
{
14501454
g_sVoteSubGroup[0] = '\0';
1451-
StartCooldown(VOTE_TYPE_MAP, winner, "", g_iVoteInitiator);
1455+
StartCooldown(VOTE_TYPE_MAP, baseGroup, "", g_iVoteInitiator);
14521456
}
14531457
}
14541458
case VOTE_TYPE_SUBGROUP:

0 commit comments

Comments
 (0)