hopefully just having the prop_dynamics killed and not respawned very early will suffice to prevent that stupid edict overflow
This commit is contained in:
parent
044ffb7847
commit
7fd559a387
@ -5,6 +5,7 @@
|
||||
#include <cstrike>
|
||||
#include <PlayerRankings>
|
||||
#include <hlstatsx_loghelper>
|
||||
#include <mapchooser_extended>
|
||||
#define MAXZONES 66
|
||||
#define ZONENAMELENGTH 256
|
||||
int g_bBlockRespawn[MAXPLAYERS+1];
|
||||
@ -23,6 +24,8 @@ bool g_is_zh_map = false;
|
||||
|
||||
bool round_start_delay;
|
||||
|
||||
bool ran_out_of_time = false;
|
||||
|
||||
//spawning the markers
|
||||
float ping_coorindates[MAXZONES][3];
|
||||
int zone_pings[MAXZONES];
|
||||
@ -333,6 +336,33 @@ public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
PrintToChatAll("Humans failed!");
|
||||
PrintToChatAll("Humans failed!");
|
||||
}
|
||||
for (int i = 0; i <= g_zoneCount; i++)
|
||||
{
|
||||
for (int j = zone_pings[i]; j < zone_pings[i + 1]; j++)
|
||||
{
|
||||
RemovePing(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMapEnd()
|
||||
{
|
||||
if (g_is_zh_map)
|
||||
{
|
||||
for (int i = 0; i <= g_zoneCount; i++)
|
||||
{
|
||||
for (int j = zone_pings[i]; j < zone_pings[i + 1]; j++)
|
||||
{
|
||||
RemovePing(j);
|
||||
/* Should hopefully help prevent these crashes
|
||||
L 11/26/2024 - 16:59:11: (70.62%) 1447 prop_dynamic
|
||||
Nov 26 16:59:11 unloze script[1920069]: L 11/26/2024 - 16:59:11: Total edicts: 2049
|
||||
Nov 26 16:59:11 unloze script[1920069]: ED_Alloc: no free edicts
|
||||
Nov 26 16:59:11 unloze script[1920069]: L 11/26/2024 - 16:59:11: Engine error: ED_Alloc: no free edicts
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -675,12 +705,29 @@ public void handle_pings(int i, int pingtype)
|
||||
{
|
||||
//the ping is atm not the skull, will be changed to skull.
|
||||
RemovePing(j);
|
||||
SpawnPing(pingtype, ping_coorindates[j], j);
|
||||
for (int client = 0; client < MaxClients; client++)
|
||||
if (!ran_out_of_time)
|
||||
{
|
||||
if (IsValidClient(client) && g_client_in_zone[client] == i)
|
||||
int timeleft = 0;
|
||||
GetMapTimeLeft(timeleft);
|
||||
if (timeleft <= 0)
|
||||
{
|
||||
display_hud_text(i, client);
|
||||
ran_out_of_time = true;
|
||||
}
|
||||
}
|
||||
//these jewish tricks should stop the crashing when switching map because the prop_dynamics are not around anymore.
|
||||
//its not the last round because timeleft is not 0
|
||||
//there is also atm no nextmap set for the server through mapchooser. This confirms that the mapvote did not set it and an
|
||||
//admin also did not set it yet.
|
||||
//just checking GetNextmap will not suffice because we always have a nextmap set.
|
||||
if (!HasEndOfMapVoteFinished() && !ran_out_of_time)
|
||||
{
|
||||
SpawnPing(pingtype, ping_coorindates[j], j);
|
||||
for (int client = 0; client < MaxClients; client++)
|
||||
{
|
||||
if (IsValidClient(client) && g_client_in_zone[client] == i)
|
||||
{
|
||||
display_hud_text(i, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -776,6 +823,7 @@ public Action ReadZoneFile()
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
ran_out_of_time = false;
|
||||
g_is_zh_map = false;
|
||||
char sConfigFile[PLATFORM_MAX_PATH];
|
||||
BuildPath(Path_SM, sConfigFile, sizeof(sConfigFile), "configs/zh_maps.cfg");
|
||||
@ -1076,38 +1124,12 @@ stock void ReplaceStrings(char[] str, char[] strReplace)
|
||||
Format(str, sizeof(l_cstrFix), l_cstrFix);
|
||||
}
|
||||
|
||||
public void OnMapEnd()
|
||||
{
|
||||
if (g_is_zh_map)
|
||||
{
|
||||
for (int i = 0; i <= g_zoneCount; i++)
|
||||
{
|
||||
for (int j = zone_pings[i]; j < zone_pings[i + 1]; j++)
|
||||
{
|
||||
RemovePing(j);
|
||||
/* Should hopefully help prevent these crashes
|
||||
L 11/26/2024 - 16:59:11: (70.62%) 1447 prop_dynamic
|
||||
Nov 26 16:59:11 unloze script[1920069]: L 11/26/2024 - 16:59:11: Total edicts: 2049
|
||||
Nov 26 16:59:11 unloze script[1920069]: ED_Alloc: no free edicts
|
||||
Nov 26 16:59:11 unloze script[1920069]: L 11/26/2024 - 16:59:11: Engine error: ED_Alloc: no free edicts
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SpawnPing(int skin, float pos[3], int index)
|
||||
{
|
||||
if (!g_is_zh_map)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (GetEntityCount() > 1900)
|
||||
{
|
||||
//this should probably never happen tbh.
|
||||
PrintToChatAll("Fail safe was activated. skipped spawning ping to prevent edict limit");
|
||||
return;
|
||||
}
|
||||
int Ent = CreateEntityByName("prop_dynamic");
|
||||
SetEntityModel(Ent, "models/unloze/unloze_ping.mdl");
|
||||
DispatchKeyValue(Ent, "modelscale", "1.5");
|
||||
|
Loading…
Reference in New Issue
Block a user