custom-chatcolors: only save file on map end to prevent lag exploits

This commit is contained in:
hubdom 2021-01-26 13:04:12 +01:00
parent fe0a20ff44
commit 2b35849922

View File

@ -187,6 +187,18 @@ void LoadConfig()
} }
} }
public void OnMapEnd()
{
KvRewind(g_hConfigFile);
KvRewind(g_hBanFile);
KeyValuesToFile(g_hConfigFile, g_sPath);
KeyValuesToFile(g_hBanFile, g_sBanPath);
}
/* public OnLibraryRemoved(const char name[]) /* public OnLibraryRemoved(const char name[])
{ {
if (StrEqual(name, "adminmenu")) if (StrEqual(name, "adminmenu"))
@ -415,12 +427,14 @@ bool SetColor(char SID[64], char Key[64], char HEX[64], int client, bool IgnoreB
} }
KvRewind(g_hConfigFile); KvRewind(g_hConfigFile);
KeyValuesToFile(g_hConfigFile, g_sPath); //KeyValuesToFile(g_hConfigFile, g_sPath);
KeyValuesToFile(g_hBanFile, g_sBanPath); //KeyValuesToFile(g_hBanFile, g_sBanPath);
LoadConfig(); OnClientPostAdminCheck(client);
Call_StartForward(configReloadedForward);
Call_Finish(); //LoadConfig();
//Call_StartForward(configReloadedForward);
//Call_Finish();
return true; return true;
} }
@ -495,12 +509,13 @@ bool SetTag(char SID[64], char text[64], int client, bool IgnoreBan=false)
} }
KvRewind(g_hConfigFile); KvRewind(g_hConfigFile);
KeyValuesToFile(g_hConfigFile, g_sPath); //KeyValuesToFile(g_hConfigFile, g_sPath);
KeyValuesToFile(g_hBanFile, g_sBanPath); //KeyValuesToFile(g_hBanFile, g_sBanPath);
OnClientPostAdminCheck(client);
LoadConfig(); //LoadConfig();
Call_StartForward(configReloadedForward); //Call_StartForward(configReloadedForward);
Call_Finish(); //Call_Finish();
return true; return true;
} }
@ -589,7 +604,7 @@ bool ToggleCCC(char SID[64], int client)
} }
KvRewind(g_hConfigFile); KvRewind(g_hConfigFile);
KeyValuesToFile(g_hConfigFile, g_sPath); //KeyValuesToFile(g_hConfigFile, g_sPath);
return true; return true;
} }