Fixed mapchooser interaction with CS:GO winlimits (bug 5484, r=psychonic).
This commit is contained in:
parent
4653530095
commit
73061969da
@ -61,6 +61,7 @@ new Handle:g_Cvar_Winlimit = INVALID_HANDLE;
|
|||||||
new Handle:g_Cvar_Maxrounds = INVALID_HANDLE;
|
new Handle:g_Cvar_Maxrounds = INVALID_HANDLE;
|
||||||
new Handle:g_Cvar_Fraglimit = INVALID_HANDLE;
|
new Handle:g_Cvar_Fraglimit = INVALID_HANDLE;
|
||||||
new Handle:g_Cvar_Bonusroundtime = INVALID_HANDLE;
|
new Handle:g_Cvar_Bonusroundtime = INVALID_HANDLE;
|
||||||
|
new Handle:g_Cvar_MatchClinch = INVALID_HANDLE;
|
||||||
|
|
||||||
/* Plugin ConVars */
|
/* Plugin ConVars */
|
||||||
new Handle:g_Cvar_StartTime = INVALID_HANDLE;
|
new Handle:g_Cvar_StartTime = INVALID_HANDLE;
|
||||||
@ -97,6 +98,7 @@ new bool:g_WaitingForVote;
|
|||||||
new bool:g_MapVoteCompleted;
|
new bool:g_MapVoteCompleted;
|
||||||
new bool:g_ChangeMapAtRoundEnd;
|
new bool:g_ChangeMapAtRoundEnd;
|
||||||
new bool:g_ChangeMapInProgress;
|
new bool:g_ChangeMapInProgress;
|
||||||
|
new bool:g_HasIntermissionStarted = false;
|
||||||
new g_mapFileSerial = -1;
|
new g_mapFileSerial = -1;
|
||||||
|
|
||||||
new g_NominateCount = 0;
|
new g_NominateCount = 0;
|
||||||
@ -148,6 +150,7 @@ public OnPluginStart()
|
|||||||
g_Cvar_Maxrounds = FindConVar("mp_maxrounds");
|
g_Cvar_Maxrounds = FindConVar("mp_maxrounds");
|
||||||
g_Cvar_Fraglimit = FindConVar("mp_fraglimit");
|
g_Cvar_Fraglimit = FindConVar("mp_fraglimit");
|
||||||
g_Cvar_Bonusroundtime = FindConVar("mp_bonusroundtime");
|
g_Cvar_Bonusroundtime = FindConVar("mp_bonusroundtime");
|
||||||
|
g_Cvar_MatchClinch = FindConVar("mp_match_can_clinch");
|
||||||
|
|
||||||
if (g_Cvar_Winlimit != INVALID_HANDLE || g_Cvar_Maxrounds != INVALID_HANDLE)
|
if (g_Cvar_Winlimit != INVALID_HANDLE || g_Cvar_Maxrounds != INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
@ -164,6 +167,12 @@ public OnPluginStart()
|
|||||||
{
|
{
|
||||||
HookEvent("round_win", Event_RoundEnd);
|
HookEvent("round_win", Event_RoundEnd);
|
||||||
}
|
}
|
||||||
|
else if (strcmp(folder, "csgo") == 0)
|
||||||
|
{
|
||||||
|
HookEvent("round_end", Event_RoundEnd);
|
||||||
|
HookEvent("cs_intermission", Event_Intermission);
|
||||||
|
HookEvent("announce_phase_end", Event_PhaseEnd);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HookEvent("round_end", Event_RoundEnd);
|
HookEvent("round_end", Event_RoundEnd);
|
||||||
@ -255,6 +264,7 @@ public OnMapEnd()
|
|||||||
g_WaitingForVote = false;
|
g_WaitingForVote = false;
|
||||||
g_ChangeMapAtRoundEnd = false;
|
g_ChangeMapAtRoundEnd = false;
|
||||||
g_ChangeMapInProgress = false;
|
g_ChangeMapInProgress = false;
|
||||||
|
g_HasIntermissionStarted = false;
|
||||||
|
|
||||||
g_VoteTimer = INVALID_HANDLE;
|
g_VoteTimer = INVALID_HANDLE;
|
||||||
g_RetryTimer = INVALID_HANDLE;
|
g_RetryTimer = INVALID_HANDLE;
|
||||||
@ -424,6 +434,26 @@ public Event_TeamPlayWinPanel(Handle:event, const String:name[], bool:dontBroadc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Event_Intermission(Handle:event, const String:name[], bool:dontBroadcast)
|
||||||
|
{
|
||||||
|
g_HasIntermissionStarted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Event_PhaseEnd(Handle:event, const String:name[], bool:dontBroadcast)
|
||||||
|
{
|
||||||
|
/* announce_phase_end fires for both half time and the end of the map, but intermission fires first for end of the map. */
|
||||||
|
if (g_HasIntermissionStarted)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No intermission yet, so this must be half time. Swap the score counters. */
|
||||||
|
new t_score = g_winCount[2];
|
||||||
|
g_winCount[2] = g_winCount[3];
|
||||||
|
g_winCount[3] = t_score;
|
||||||
|
}
|
||||||
|
|
||||||
/* You ask, why don't you just use team_score event? And I answer... Because CSS doesn't. */
|
/* You ask, why don't you just use team_score event? And I answer... Because CSS doesn't. */
|
||||||
public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
|
public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
|
||||||
{
|
{
|
||||||
@ -481,6 +511,22 @@ public CheckWinLimit(winner_score)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_Cvar_MatchClinch != INVALID_HANDLE && g_Cvar_Maxrounds != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
new clinch = GetConVarInt(g_Cvar_MatchClinch);
|
||||||
|
|
||||||
|
if (clinch)
|
||||||
|
{
|
||||||
|
new maxrounds = GetConVarInt(g_Cvar_Maxrounds);
|
||||||
|
new winlimit = maxrounds / 2;
|
||||||
|
|
||||||
|
if(winner_score > (winlimit - GetConVarInt(g_Cvar_StartRounds)))
|
||||||
|
{
|
||||||
|
InitiateVote(MapChange_MapEnd, INVALID_HANDLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckMaxRounds(roundcount)
|
public CheckMaxRounds(roundcount)
|
||||||
|
Loading…
Reference in New Issue
Block a user