forgot what i updated again but looks good on ze now. the random extend vote should hopefully not happen anymore when not intended. the mp_chattime stuff was moved to pluginstart, mapstart and mapend and seems to let the vote run fine now instead of switching map
This commit is contained in:
parent
e35b6a55ab
commit
3589dd66a3
@ -430,6 +430,10 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
|
|
||||||
InternalRestoreMapCooldowns();
|
InternalRestoreMapCooldowns();
|
||||||
|
|
||||||
|
|
||||||
|
int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_WarningTime) + 10;
|
||||||
|
ServerCommand("sm_cvar mp_chattime %i", total_time); //prevents map switching supposedly.
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Cvar_playerExcludeSpec(ConVar convar, const char[] oldValue, const char[] newValue)
|
public void Cvar_playerExcludeSpec(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||||
@ -490,6 +494,8 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
|||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
|
int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_WarningTime) + 10;
|
||||||
|
ServerCommand("sm_cvar mp_chattime %i", total_time); //prevents map switching supposedly.
|
||||||
g_DidRoundTerminate = false;
|
g_DidRoundTerminate = false;
|
||||||
g_IniatedLastVote = false;
|
g_IniatedLastVote = false;
|
||||||
g_DidNotExtend = false;
|
g_DidNotExtend = false;
|
||||||
@ -589,6 +595,9 @@ public void OnConfigsExecuted()
|
|||||||
|
|
||||||
public void OnMapEnd()
|
public void OnMapEnd()
|
||||||
{
|
{
|
||||||
|
int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_WarningTime) + 10;
|
||||||
|
ServerCommand("sm_cvar mp_chattime %i", total_time);
|
||||||
|
|
||||||
g_DidNotExtend = false;
|
g_DidNotExtend = false;
|
||||||
ServerCommand("sm_cvar sm_vote_progress_hintbox 1"); //yeah its cheesy but does the job.
|
ServerCommand("sm_cvar sm_vote_progress_hintbox 1"); //yeah its cheesy but does the job.
|
||||||
g_iInterval = 0;
|
g_iInterval = 0;
|
||||||
@ -820,6 +829,13 @@ public Action Timer_StartWarningTimer(Handle timer)
|
|||||||
{
|
{
|
||||||
g_VoteTimer = INVALID_HANDLE;
|
g_VoteTimer = INVALID_HANDLE;
|
||||||
|
|
||||||
|
int timeleft;
|
||||||
|
GetMapTimeLeft(timeleft);
|
||||||
|
if (timeleft <= 0 && !g_ChangeMapAtRoundEnd) //somehow a random vote might get triggered. this should prevent it
|
||||||
|
{
|
||||||
|
return Plugin_Stop;
|
||||||
|
}
|
||||||
|
|
||||||
if(!g_WarningInProgress || g_WarningTimer == INVALID_HANDLE)
|
if(!g_WarningInProgress || g_WarningTimer == INVALID_HANDLE)
|
||||||
{
|
{
|
||||||
if (!g_IniatedLastVote)
|
if (!g_IniatedLastVote)
|
||||||
@ -959,19 +975,34 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
|
|||||||
g_DidRoundTerminate = true;
|
g_DidRoundTerminate = true;
|
||||||
return Plugin_Handled; //it keeps retriggering this Action.
|
return Plugin_Handled; //it keeps retriggering this Action.
|
||||||
}
|
}
|
||||||
|
if (g_IniatedLastVote)
|
||||||
|
{
|
||||||
|
return Plugin_Handled; //just extra safety check
|
||||||
|
}
|
||||||
if (timeleft <= 0 && !g_ChangeMapAtRoundEnd)
|
if (timeleft <= 0 && !g_ChangeMapAtRoundEnd)
|
||||||
{
|
{
|
||||||
|
int total_time = (GetConVarInt(g_Cvar_VoteDuration) * 2) + GetConVarInt(g_Cvar_WarningTime) + 10;
|
||||||
if (!g_IniatedLastVote)
|
if (!g_IniatedLastVote)
|
||||||
{
|
{
|
||||||
g_IniatedLastVote = true;
|
g_IniatedLastVote = true;
|
||||||
|
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
|
InitiateVote(MapChange_Instant); //feature so mapvote happens at actual mapend
|
||||||
}
|
}
|
||||||
return Plugin_Handled;
|
delay = float(total_time);
|
||||||
|
return Plugin_Changed;
|
||||||
}
|
}
|
||||||
g_DidRoundTerminate = false;
|
g_DidRoundTerminate = false;
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp)
|
||||||
|
{
|
||||||
|
ForceChangeLevel("ze_random_v9", "nobody voted at mapvote");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
/* 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 void Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast)
|
public void Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast)
|
||||||
{
|
{
|
||||||
@ -2351,6 +2382,12 @@ public int Native_InitiateVote(Handle plugin, int numParams)
|
|||||||
|
|
||||||
LogAction(-1, -1, "Starting map vote because outside request");
|
LogAction(-1, -1, "Starting map vote because outside request");
|
||||||
|
|
||||||
|
int timeleft;
|
||||||
|
GetMapTimeLeft(timeleft);
|
||||||
|
if (timeleft <= 0 && !g_ChangeMapAtRoundEnd) //somehow a random vote might get triggered. this should prevent it
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (!g_IniatedLastVote)
|
if (!g_IniatedLastVote)
|
||||||
{
|
{
|
||||||
SetupWarningTimer(WarningType_Vote, when, inputarray);
|
SetupWarningTimer(WarningType_Vote, when, inputarray);
|
||||||
|
Loading…
Reference in New Issue
Block a user