From 2e4e6d1fcf9fe5f015780e92b9bba6e2cc895700 Mon Sep 17 00:00:00 2001 From: BotoX Date: Fri, 17 Aug 2018 23:22:41 +0200 Subject: [PATCH] SMJSONAPI: fix bugs --- SMJSONAPI/scripting/GameEvents.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SMJSONAPI/scripting/GameEvents.inc b/SMJSONAPI/scripting/GameEvents.inc index 57673ee3..b29ab478 100644 --- a/SMJSONAPI/scripting/GameEvents.inc +++ b/SMJSONAPI/scripting/GameEvents.inc @@ -69,8 +69,8 @@ static void GameEvents_OnHook(Event event, const char[] name, bool dontBroadcast jEventData.SetString(sKey, sValue); } } while(g_Config.GotoNextKey(false)); - g_Config.Rewind(); } + g_Config.Rewind(); jEvent.Set("data", jEventData); @@ -86,6 +86,7 @@ int GameEvents_Hook(const char[] sEventName) if(Hooked) { g_Config.SetNum("_hooked", Hooked + 1); + g_Config.Rewind(); return Hooked + 1; } @@ -104,7 +105,10 @@ int GameEvents_Unhook(const char[] sEventName) int Hooked = g_Config.GetNum("_hooked", 0); if(!Hooked) + { + g_Config.Rewind(); return 0; + } if(Hooked == 1) UnhookEvent(sEventName, GameEvents_OnHook, EventHookMode_Post);