From 06e5c325accca189f260353e8cc8f404e247dcfa Mon Sep 17 00:00:00 2001 From: jenz Date: Tue, 2 Jun 2026 16:52:14 +0200 Subject: [PATCH] just a timer running each second deciding if nowinpannel is enabled or not --- .../mapchooser_extended_avg_mapend.sp | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp index 14c415e..341d04f 100755 --- a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp +++ b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp @@ -138,6 +138,8 @@ 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_mapFileSerial = -1; int g_iSkipAllRestrictions; @@ -241,6 +243,7 @@ public void OnPluginEnd() public void OnPluginStart() { + CreateTimer(1.0, Timer_Countdown1, _, TIMER_REPEAT); LoadTranslations("mapchooser_extended.phrases"); LoadTranslations("basevotes.phrases"); LoadTranslations("common.phrases"); @@ -991,6 +994,7 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason) 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. @@ -1002,7 +1006,7 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason) return Plugin_Changed; } - if (timeleft <= 0 && g_iNextmapState >= 3) + 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) @@ -1095,11 +1099,13 @@ public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp) return Plugin_Handled; } + /* You ask, why don't you just use team_score event? And I answer... Because CSS doesn't. */ 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 { char map[PLATFORM_MAX_PATH]; @@ -1627,8 +1633,32 @@ 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;