instead of hard coding to ze_random_v9 it now takes the startup map when server is restarted

This commit is contained in:
jenz 2026-03-05 14:49:42 +01:00
parent c0cddad8cb
commit d78c39cf3c

View File

@ -1014,7 +1014,7 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
//that is rather problematic because it often leads to the very first people connecting wanting to leave again because the game is stuck. //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) if (timeleft < 0 && g_iNextmapState == 0)
{ {
LogMessage("in CS_OnTerminateRound being hard stuck. switching map to ze_random_v9. 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); CreateTimer(1.0, Timer_fall_back_map_switch, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
} }
return Plugin_Continue; return Plugin_Continue;
@ -1035,8 +1035,18 @@ public Action unfreeze_players2(Handle hTimer, Handle dp)
public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp) public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp)
{ {
ForceChangeLevel("ze_random_v9", "nobody voted at mapvote"); char map_line[256];
return Plugin_Handled; File f = OpenFile("cfg/defaultmap.cfg", "r");
if (f != null)
{
f.ReadLine(map_line, sizeof(map_line));
CloseHandle(f);
}
ReplaceString(map_line, sizeof(map_line), "map ", "");
TrimString(map_line);
//LogMessage("map_line: %s", map_line);
ForceChangeLevel(map_line, "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. */