added a bit delay on mapchange before writing data to file

This commit is contained in:
jenz 2024-06-30 01:18:58 +02:00
parent 20f1536410
commit 719425da9e

View File

@ -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));