removed the map end version and avg version. now its just called unloze. it still has average and new features from mapend, but i removed the actual mapend functionality due to players always saying they were stucked by the scoreboard pannel
This commit is contained in:
parent
56c97b7d29
commit
e0672ab09b
File diff suppressed because it is too large
Load Diff
@ -137,10 +137,8 @@ bool g_WaitingForVote;
|
||||
bool g_MapVoteCompleted;
|
||||
bool g_ChangeMapInProgress;
|
||||
bool g_HasIntermissionStarted = false;
|
||||
bool g_RtvInitiated = false;
|
||||
bool g_bSset_win_map = false;
|
||||
|
||||
int g_iNextmapState = 0; //0 = nothing. 1 = rtv succesfull. 2 = admin used setnextmap. 3 = did not extend or used all extends. 4 = vote at end of map is going on.
|
||||
int g_iNextmapState = 0; //0 = nothing. 1 = rtv succesfull. 2 = admin used setnextmap. 3 = did not extend or used all extends.
|
||||
int g_mapFileSerial = -1;
|
||||
int g_iSkipAllRestrictions;
|
||||
int g_iDontCooldownMap;
|
||||
@ -243,7 +241,6 @@ public void OnPluginEnd()
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
CreateTimer(1.0, Timer_Countdown1, _, TIMER_REPEAT);
|
||||
LoadTranslations("mapchooser_extended.phrases");
|
||||
LoadTranslations("basevotes.phrases");
|
||||
LoadTranslations("common.phrases");
|
||||
@ -407,9 +404,6 @@ public void OnPluginStart()
|
||||
|
||||
HookEvent("player_death", Event_PlayerDeath);
|
||||
|
||||
//2026 edit: block cs_win_panel_match from triggering on Intermission so that people dont get stuck with a scoreboard they cant close.
|
||||
HookEvent("cs_win_panel_match", Event_BlockWinPanel, EventHookMode_Pre);
|
||||
|
||||
AutoExecConfig(true, "mapchooser_extended");
|
||||
|
||||
//Change the mp_bonusroundtime max so that we have time to display the vote
|
||||
@ -510,7 +504,6 @@ public Action GetInternalGetCvars(Handle timer)
|
||||
public void OnMapStart()
|
||||
{
|
||||
g_iNextmapState = 0;
|
||||
g_RtvInitiated = false;
|
||||
CreateTimer(1.0, GetInternalGetCvars);
|
||||
|
||||
int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_RunOffWarningTime) + 10;
|
||||
@ -641,7 +634,6 @@ public void OnMapEnd()
|
||||
{
|
||||
g_first_map_no_cooldown = false;
|
||||
g_iNextmapState = 0;
|
||||
g_RtvInitiated = false;
|
||||
int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_RunOffWarningTime) + 10;
|
||||
ServerCommand("sm_cvar mp_chattime %i", total_time);
|
||||
|
||||
@ -782,23 +774,6 @@ public void OnMapTimeLeftChanged()
|
||||
|
||||
void SetupTimeleftTimer()
|
||||
{
|
||||
if (g_iNextmapState == 0 && GetConVarInt(g_Cvar_Extend) == 0)
|
||||
{
|
||||
g_iNextmapState = 3;
|
||||
//map simply had no extend to begin with. mce_extend 0.
|
||||
//encap made me notice that maps without extends would still incorrectly do the setup Timeleft Timer() call.
|
||||
}
|
||||
|
||||
if (g_iNextmapState != 0)
|
||||
{
|
||||
if (g_VoteTimer != INVALID_HANDLE)
|
||||
{
|
||||
KillTimer(g_VoteTimer);
|
||||
g_VoteTimer = INVALID_HANDLE;
|
||||
}
|
||||
return; //all extends were used or map was not extended or rtv was succesfull or admin set nextmap
|
||||
}
|
||||
|
||||
int time;
|
||||
if(GetMapTimeLeft(time) && time > 0)
|
||||
{
|
||||
@ -911,10 +886,6 @@ public Action Timer_StartMapVote(Handle timer, Handle data)
|
||||
MapChange mapChange = view_as<MapChange>(ReadPackCell(data));
|
||||
Handle hndl = view_as<Handle>(ReadPackCell(data));
|
||||
//LogMessage("Mapchooser_extended_avg calling InitiateVote()");
|
||||
if (mapChange == MapChange_MapEnd && GetConVarInt(g_Cvar_Extend) - g_Extends < 1)
|
||||
{
|
||||
return Plugin_Stop; //feature where normal map changes does not happen if we ran out of extends, instead end of map does the actual real vote.
|
||||
}
|
||||
InitiateVote(mapChange, hndl);
|
||||
return Plugin_Stop;
|
||||
}
|
||||
@ -972,12 +943,6 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
|
||||
{
|
||||
int timeleft;
|
||||
GetMapTimeLeft(timeleft);
|
||||
//cases that can happen:
|
||||
//0 timeleft and admin did setnextmap.
|
||||
//0 timeleft and rtv already picked a map. (round_end event forces the nextmap)
|
||||
//0 timeleft and all extends used or map was not extended. (we do the map vote at map end)
|
||||
//0 timeleft and rtv is ongoing still
|
||||
|
||||
//yeah sure why not just do it on every round end anyways.
|
||||
if (GetClientCount(false) > g_iDontCooldownMap && !g_first_map_no_cooldown)
|
||||
{
|
||||
@ -992,68 +957,16 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
|
||||
SetSharedCooldowns(map);
|
||||
}
|
||||
|
||||
if (timeleft <= 0 && g_RtvInitiated && g_iNextmapState < 4) //last round was terminated, rtv is going on and we did not set g_i Nextmapstate yet.
|
||||
{
|
||||
|
||||
//extra time in case of rtv, rtv run-off (there is no dont change option here as we already used all extends or people voted dont extend)
|
||||
int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_RunOffWarningTime) + 10;
|
||||
g_iNextmapState = 4; //rtv vote going on already, so lets not repeat that.
|
||||
CreateTimer(1.0, unfreeze_players, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
//extending the map allows players to run around instead of being frozen. should just be careful about it running into edicts limits
|
||||
|
||||
CreateTimer(float(total_time + 10), Timer_fall_back_map_switch, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
delay = float(total_time);
|
||||
return Plugin_Changed;
|
||||
}
|
||||
|
||||
if (timeleft <= 0 && g_iNextmapState >= 3) //last round was terminated. time for mapvote now.
|
||||
{
|
||||
int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_RunOffWarningTime) + 10;
|
||||
if (g_iNextmapState == 3)
|
||||
{
|
||||
if (IsVoteInProgress()) //fucking admins being brain dead doing extend votes right when the map ends.
|
||||
{
|
||||
PrintToChatAll("The admin slept on the job again. Should had made that extend vote 2-3 minutes before the timeleft ran out instead of panic extend voting the last second possible.");
|
||||
CancelVote();
|
||||
}
|
||||
g_iNextmapState = 4; //started vote, so lets not repeat that.
|
||||
CreateTimer(float(total_time + 10), Timer_fall_back_map_switch, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
//sometimes it will simply happen that theres a mapvote where nobody votes anything.
|
||||
//have to prevent server from being stuck in those situations with this timer.
|
||||
|
||||
InitiateVote(MapChange_Instant); //feature so mapvote happens at actual mapend
|
||||
|
||||
CreateTimer(1.0, unfreeze_players, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
//extending the map allows players to run around instead of being frozen. should just be careful about it running into edicts limits
|
||||
}
|
||||
delay = float(total_time);
|
||||
return Plugin_Changed;
|
||||
}
|
||||
|
||||
|
||||
//when you join the ze server as the first player and theres 0 timeleft and no map was selected the server can get stuck for 2 minutes.
|
||||
//that is rather problematic because it often leads to the very first people connecting wanting to leave again because the game is stuck.
|
||||
if (timeleft < 0 && g_iNextmapState == 0)
|
||||
{
|
||||
LogMessage("in CS_OnTerminateRound being hard stuck. switching map to default start map. timeleft: %i", timeleft);
|
||||
//LogMessage("in CS_OnTerminateRound being hard stuck. switching map to default start map. timeleft: %i", timeleft);
|
||||
CreateTimer(1.0, Timer_fall_back_map_switch, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action unfreeze_players(Handle hTimer, Handle dp)
|
||||
{
|
||||
ServerCommand("sm_testround");
|
||||
CreateTimer(1.0, unfreeze_players2, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action unfreeze_players2(Handle hTimer, Handle dp)
|
||||
{
|
||||
ServerCommand("sm_extend 20"); //this is not actually meant for extending the map. Its meant to unfreeze players during the mapvote.
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp)
|
||||
{
|
||||
static char map[PLATFORM_MAX_PATH];
|
||||
@ -1106,7 +1019,7 @@ public void Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast)
|
||||
int timeleft;
|
||||
GetMapTimeLeft(timeleft);
|
||||
|
||||
if (g_iNextmapState == 1 || (g_iNextmapState == 2 && timeleft <= 0)) //rtv went through or admin used setnextmap
|
||||
if (g_iNextmapState == 1 || (g_iNextmapState >= 2 && timeleft <= 0)) //rtv went through or admin used setnextmap or we used all extends.
|
||||
{
|
||||
char map[PLATFORM_MAX_PATH];
|
||||
GetNextMap(map, sizeof(map));
|
||||
@ -1182,11 +1095,6 @@ public void CheckMaxRounds(int roundcount)
|
||||
}
|
||||
}
|
||||
|
||||
public Action Event_BlockWinPanel(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
if(!GetArraySize(g_MapList) || g_HasVoteStarted)
|
||||
@ -1377,7 +1285,7 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
|
||||
WritePackString(data, "Revote Warning");
|
||||
else
|
||||
{
|
||||
if (when == MapChange_MapEnd)
|
||||
if (when == MapChange_MapEnd && g_iNextmapState != 3) //we already used all extends
|
||||
{
|
||||
WritePackString(data, "Vote Warning Extend");
|
||||
}
|
||||
@ -1453,7 +1361,8 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
|
||||
*/
|
||||
|
||||
static char map[PLATFORM_MAX_PATH];
|
||||
if (when == MapChange_MapEnd) //18th september feature idea where a normal mapvote at 3 minutes is between extend or not extend.
|
||||
//its a vote for extend or dont extend. unless people voted to not extend or all extends were used.
|
||||
if (when == MapChange_MapEnd && g_iNextmapState != 3)
|
||||
{
|
||||
SetMenuTitle(g_VoteMenu, "Vote Extend");
|
||||
AddMenuItem(g_VoteMenu, LINE_ONE, "Choose something...", ITEMDRAW_DISABLED);
|
||||
@ -1633,32 +1542,8 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE)
|
||||
PrintToChatAll("[MCE] Voting for next map has started.");
|
||||
}
|
||||
|
||||
public Action Timer_Countdown1(Handle timer)
|
||||
{
|
||||
int timeleft;
|
||||
GetMapTimeLeft(timeleft);
|
||||
if (timeleft <= 0)
|
||||
{
|
||||
if (!g_bSset_win_map)
|
||||
{
|
||||
ServerCommand("sm_cvar sv_nowinpanel 1"); //prevents pannel from blocking vote result for mapvotes at mapend.
|
||||
}
|
||||
g_bSset_win_map = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_bSset_win_map)
|
||||
{
|
||||
ServerCommand("sm_cvar sv_nowinpanel 0"); //we display the pannel again.
|
||||
}
|
||||
g_bSset_win_map = false;
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action Timer_Countdown(Handle timer)
|
||||
{
|
||||
|
||||
if (g_iInterval <= 0)
|
||||
return Plugin_Stop;
|
||||
|
||||
@ -1783,9 +1668,6 @@ public void Handler_VoteFinishedGeneric(char[] map,
|
||||
}
|
||||
else if(strcmp(map, VOTE_DONTCHANGE, false) == 0)
|
||||
{
|
||||
//dont change option in rtv cannot happen after the last extend was used or after people voting dong extend
|
||||
//so there is no risk of a mapend rtv having the dont change option possible.
|
||||
g_RtvInitiated = false; //reset the bool again
|
||||
PrintToChatAll("[MCE] Current map continues! The Vote has spoken! (Received %i/%i of votes)", map_votes, num_votes);
|
||||
LogAction(-1, -1, "Voting for next map has finished. 'No Change' was the winner");
|
||||
|
||||
@ -1797,9 +1679,9 @@ public void Handler_VoteFinishedGeneric(char[] map,
|
||||
{
|
||||
if(g_ChangeTime == MapChange_MapEnd)
|
||||
{
|
||||
g_iNextmapState = 3; //map was not extended
|
||||
SetNextMap(map);
|
||||
}
|
||||
else if(g_ChangeTime == MapChange_Instant) //end of map voting ends up here because we change instantly.
|
||||
else if(g_ChangeTime == MapChange_Instant)
|
||||
{
|
||||
PrintToChatAll("[MCE] Next Map: %s", map);
|
||||
PrintToChatAll("[MCE] Next Map: %s", map);
|
||||
@ -1811,32 +1693,21 @@ public void Handler_VoteFinishedGeneric(char[] map,
|
||||
}
|
||||
else // MapChange_RoundEnd
|
||||
{
|
||||
if (g_iNextmapState == 4 && g_RtvInitiated) //timeleft is 0, the last round was terminated but rtv still on going. go to the rtv map now.
|
||||
{
|
||||
PrintToChatAll("[MCE] Next Map: %s", map);
|
||||
PrintToChatAll("[MCE] Next Map: %s", map);
|
||||
PrintToChatAll("[MCE] Next Map: %s", map);
|
||||
Handle data;
|
||||
CreateDataTimer(4.0, Timer_ChangeMap, data);
|
||||
WritePackString(data, map);
|
||||
g_ChangeMapInProgress = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_iNextmapState = 1; //rtv was performed.
|
||||
SetNextMap(map);
|
||||
}
|
||||
g_RtvInitiated = false;
|
||||
g_iNextmapState = 1; //rtv was performed.
|
||||
SetNextMap(map);
|
||||
}
|
||||
|
||||
g_HasVoteStarted = false;
|
||||
g_MapVoteCompleted = true;
|
||||
|
||||
//PrintToChatAll("map: %s", map);
|
||||
if (g_ChangeTime == MapChange_MapEnd)
|
||||
if (g_ChangeTime == MapChange_MapEnd && g_iNextmapState != 3) //if we already indicated that map was not extended we are done.
|
||||
{
|
||||
PrintToChatAll("[MCE] Extend voting finished. The map was not extended. (Received %i/%i of votes)", map_votes, num_votes);
|
||||
g_MapVoteCompleted = false; //this was only the extend or dont extend vote, still need actual mapvote.
|
||||
g_iNextmapState = 3; //the map was simply not extended
|
||||
PrintToChatAll("[MCE] Starting next map vote in 10 seconds!");
|
||||
CreateTimer(10.0, MapVoteNotextended);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1846,6 +1717,12 @@ public void Handler_VoteFinishedGeneric(char[] map,
|
||||
}
|
||||
}
|
||||
|
||||
public Action MapVoteNotextended(Handle timer)
|
||||
{
|
||||
InitiateVote(MapChange_MapEnd); //since the map was not extended its time for next map vote right now.
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public void Handler_MapVoteFinished(Handle menu,
|
||||
int num_votes,
|
||||
int num_clients,
|
||||
@ -2019,7 +1896,7 @@ public int Handler_MapVoteMenu(Handle menu, MenuAction action, int param1, int p
|
||||
|
||||
//displaying to the client how much his vote is worth.
|
||||
//second parameter shows for example 5.0, last parameter is how much percentage of the entire vote the client decides.
|
||||
if (g_ChangeTime == MapChange_MapEnd)
|
||||
if (g_ChangeTime == MapChange_MapEnd && g_iNextmapState != 3) //if we did not extend or used all extends dont show this.
|
||||
{
|
||||
Format(buffer, sizeof(buffer), "%T", "Vote Extend", param1, GetPlayerWorthRTV_boost_(param1));
|
||||
}
|
||||
@ -2463,14 +2340,6 @@ public int Native_InitiateVote(Handle plugin, int numParams)
|
||||
MapChange when = view_as<MapChange>(GetNativeCell(1));
|
||||
Handle inputarray = view_as<Handle>(GetNativeCell(2));
|
||||
|
||||
//what is this used for? people care about being able to do rtv even if its the last round
|
||||
//and even if the rtv should be going on after the last round ending
|
||||
if (g_iNextmapState == 4)
|
||||
{
|
||||
PrintToChatAll("Not doing rtv because end vote already is going on.");
|
||||
return 0;
|
||||
}
|
||||
g_RtvInitiated = true;
|
||||
SetupWarningTimer(WarningType_Vote, when, inputarray);
|
||||
//LogMessage("SetupWarningTimer 9");
|
||||
//PrintToChatAll("SetupWarningTimer 9");
|
||||
@ -2562,7 +2431,7 @@ stock void SetupWarningTimer(WarningType type, MapChange when=MapChange_MapEnd,
|
||||
{
|
||||
forwardVote = g_MapVoteWarningStartForward;
|
||||
cvarTime = g_Cvar_WarningTime;
|
||||
if (when == MapChange_MapEnd)
|
||||
if (when == MapChange_MapEnd && g_iNextmapState != 3)
|
||||
{
|
||||
strcopy(translationKey, sizeof(translationKey), "Vote Warning Extend");
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user