just a timer running each second deciding if nowinpannel is enabled or not
This commit is contained in:
parent
4914461539
commit
06e5c325ac
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user