From 719425da9e86bfc0598c9765fecfc768c4325aa1 Mon Sep 17 00:00:00 2001 From: jenz Date: Sun, 30 Jun 2024 01:18:58 +0200 Subject: [PATCH] added a bit delay on mapchange before writing data to file --- .../scripting/simulate_ze_server.sp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/simulate_ze_server/scripting/simulate_ze_server.sp b/simulate_ze_server/scripting/simulate_ze_server.sp index b78f57a6..44ecd69b 100644 --- a/simulate_ze_server/scripting/simulate_ze_server.sp +++ b/simulate_ze_server/scripting/simulate_ze_server.sp @@ -6,6 +6,7 @@ int server_ports[2] = {27015, 27075}; //server ports: ze server, simulated server. int g_iServerPort; int g_iClientIndexUserIDMapping[MAXPLAYERS + 1]; +bool g_bCooldownMapChange = false; char g_cClientNewName[MAXPLAYERS + 1][128]; @@ -33,6 +34,7 @@ public void OnPluginEnd() public void OnPluginStart() { + g_bCooldownMapChange = false; g_iServerPort = GetConVarInt(FindConVar("hostport")); if (g_iServerPort == server_ports[0]) { @@ -196,8 +198,24 @@ public Action read_info_over_txt(Handle timer, any data) return Plugin_Handled; } +public void OnMapEnd() +{ + g_bCooldownMapChange = true; + CreateTimer(20.0, allow_updating_again); +} + +public Action allow_updating_again(Handle timer, any data) +{ + g_bCooldownMapChange = false; + return Plugin_Handled; +} + public Action update_info_over_txt(Handle timer, any data) { + if (g_bCooldownMapChange) + { + return Plugin_Handled; + } //sending map name, hostname and player names to the simulate server from ze server. char g_cMapname[256]; GetCurrentMap(g_cMapname, sizeof(g_cMapname));