From 2b35849922ff66f77c8160226eec91d9ed049371 Mon Sep 17 00:00:00 2001 From: hubdom <26039831+hubdom@users.noreply.github.com> Date: Tue, 26 Jan 2021 13:04:12 +0100 Subject: [PATCH] custom-chatcolors: only save file on map end to prevent lag exploits --- .../scripting/custom-chatcolors.sp | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/custom-chatcolors/scripting/custom-chatcolors.sp b/custom-chatcolors/scripting/custom-chatcolors.sp index 736f4f55..a02fa634 100644 --- a/custom-chatcolors/scripting/custom-chatcolors.sp +++ b/custom-chatcolors/scripting/custom-chatcolors.sp @@ -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[]) { 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); - KeyValuesToFile(g_hConfigFile, g_sPath); - KeyValuesToFile(g_hBanFile, g_sBanPath); + //KeyValuesToFile(g_hConfigFile, g_sPath); + //KeyValuesToFile(g_hBanFile, g_sBanPath); - LoadConfig(); - Call_StartForward(configReloadedForward); - Call_Finish(); + OnClientPostAdminCheck(client); + + //LoadConfig(); + //Call_StartForward(configReloadedForward); + //Call_Finish(); return true; } @@ -495,12 +509,13 @@ bool SetTag(char SID[64], char text[64], int client, bool IgnoreBan=false) } KvRewind(g_hConfigFile); - KeyValuesToFile(g_hConfigFile, g_sPath); - KeyValuesToFile(g_hBanFile, g_sBanPath); + //KeyValuesToFile(g_hConfigFile, g_sPath); + //KeyValuesToFile(g_hBanFile, g_sBanPath); + OnClientPostAdminCheck(client); - LoadConfig(); - Call_StartForward(configReloadedForward); - Call_Finish(); + //LoadConfig(); + //Call_StartForward(configReloadedForward); + //Call_Finish(); return true; } @@ -589,7 +604,7 @@ bool ToggleCCC(char SID[64], int client) } KvRewind(g_hConfigFile); - KeyValuesToFile(g_hConfigFile, g_sPath); + //KeyValuesToFile(g_hConfigFile, g_sPath); return true; }