diff --git a/zombie_hunting_respawn/zh_respawn_stop.sp b/zombie_hunting_respawn/zh_respawn_stop.sp index 28f6ed6c..aa20a125 100644 --- a/zombie_hunting_respawn/zh_respawn_stop.sp +++ b/zombie_hunting_respawn/zh_respawn_stop.sp @@ -659,6 +659,8 @@ public void unloze_zoneEntry(int client, char[] zone) } } + + public void handle_pings(int i, int pingtype) { if (!g_is_zh_map) @@ -1074,12 +1076,38 @@ 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");