From 6ffdbde668fc675ff136bc465d47b7b486fe7d6c Mon Sep 17 00:00:00 2001 From: BotoX Date: Thu, 3 Oct 2019 13:45:17 +0200 Subject: [PATCH] fix UNLOZE+ReservedSlots fix dependency unload error in a few plugins with LibraryExists in OnAllPluginsLoaded --- .../scripting/AdvancedTargeting.sp | 3 ++ LagCompensation/scripting/LagCompensation.sp | 6 ++++ .../scripting/PlayerVisibility.sp | 12 ++++++++ ReservedSlot/scripting/ReservedSlot.sp | 15 ++++++---- SelfMute/scripting/SelfMute.sp | 3 ++ .../scripting/UNLOZE_ForumIntegration.sp | 20 ++++++------- includes/GFLClanru.inc | 30 ------------------- includes/unloze.inc | 18 +++++------ 8 files changed, 52 insertions(+), 55 deletions(-) delete mode 100644 includes/GFLClanru.inc diff --git a/AdvancedTargeting/scripting/AdvancedTargeting.sp b/AdvancedTargeting/scripting/AdvancedTargeting.sp index 3ee2ee1b..15a9d800 100644 --- a/AdvancedTargeting/scripting/AdvancedTargeting.sp +++ b/AdvancedTargeting/scripting/AdvancedTargeting.sp @@ -105,6 +105,9 @@ public void OnAllPluginsLoaded() (g_Extension_Voice ? "loaded" : "not loaded")); } +public void OnLibraryAdded(const char[] name) { OnAllPluginsLoaded(); } +public void OnLibraryRemoved(const char[] name) { OnAllPluginsLoaded(); } + public Action Command_Admins(int client, int args) { char aBuf[1024]; diff --git a/LagCompensation/scripting/LagCompensation.sp b/LagCompensation/scripting/LagCompensation.sp index 2fd15856..4c4a1429 100644 --- a/LagCompensation/scripting/LagCompensation.sp +++ b/LagCompensation/scripting/LagCompensation.sp @@ -372,9 +372,15 @@ public void OnRunThinkFunctionsPost(bool simulating) g_aaLagRecords[i][iOldRecord].vecOrigin[2] == TmpRecord.vecOrigin[2]) { g_aEntityLagData[i].iNotMoving++; + if(g_aEntityLagData[i].iNotMoving == MAX_RECORDS) + LogMessage("[%d] index %d, entity %d GOING TO SLEEP", GetGameTickCount(), i, g_aEntityLagData[i].iEntity); } else + { + if(g_aEntityLagData[i].iNotMoving >= MAX_RECORDS) + LogMessage("[%d] index %d, entity %d WAKING UP", GetGameTickCount(), i, g_aEntityLagData[i].iEntity); g_aEntityLagData[i].iNotMoving = 0; + } if(g_aEntityLagData[i].iNotMoving >= MAX_RECORDS) continue; diff --git a/PlayerVisibility/scripting/PlayerVisibility.sp b/PlayerVisibility/scripting/PlayerVisibility.sp index 4fa46ac1..8e0488d7 100644 --- a/PlayerVisibility/scripting/PlayerVisibility.sp +++ b/PlayerVisibility/scripting/PlayerVisibility.sp @@ -100,6 +100,18 @@ public void OnAllPluginsLoaded() g_Plugin_zombiereloaded = LibraryExists("zombiereloaded"); } +public void OnLibraryAdded(const char[] sName) +{ + if(strcmp(sName, "zombiereloaded", false) == 0) + g_Plugin_zombiereloaded = true; +} + +public void OnLibraryRemoved(const char[] sName) +{ + if(strcmp(sName, "zombiereloaded", false) == 0) + g_Plugin_zombiereloaded = false; +} + public void OnPluginEnd() { KillTimer(g_hThinkTimer); diff --git a/ReservedSlot/scripting/ReservedSlot.sp b/ReservedSlot/scripting/ReservedSlot.sp index 84f981ce..a982c212 100644 --- a/ReservedSlot/scripting/ReservedSlot.sp +++ b/ReservedSlot/scripting/ReservedSlot.sp @@ -4,14 +4,14 @@ #undef REQUIRE_PLUGIN #include -#include +#include #define REQUIRE_PLUGIN #pragma semicolon 1 #pragma newdecls required bool g_Plugin_AFKManager; -bool g_Plugin_GFLClanru; +bool g_Plugin_UNLOZE; int g_Client_Reservation[MAXPLAYERS + 1] = {0, ...}; @@ -37,13 +37,16 @@ public void OnPluginStart() public void OnAllPluginsLoaded() { g_Plugin_AFKManager = LibraryExists("AFKManager"); - g_Plugin_GFLClanru = LibraryExists("GFLClanru"); + g_Plugin_UNLOZE = LibraryExists("UNLOZE_ForumIntegration"); - LogMessage("ReservedSlots capabilities:\nAFKManager: %s\nGFLClanru: %s\nentWatch: %s", + LogMessage("ReservedSlots capabilities:\nAFKManager: %s\nUNLOZE: %s\n", (g_Plugin_AFKManager ? "loaded" : "not loaded"), - (g_Plugin_GFLClanru ? "loaded" : "not loaded")); + (g_Plugin_UNLOZE ? "loaded" : "not loaded")); } +public void OnLibraryAdded(const char[] name) { OnAllPluginsLoaded(); } +public void OnLibraryRemoved(const char[] name) { OnAllPluginsLoaded(); } + public void OnClientPostAdminCheck(int client) { AdminId admin = GetUserAdmin(client); @@ -87,7 +90,7 @@ public EConnect OnClientPreConnectEx(const char[] sName, char sPassword[255], co return k_OnClientPreConnectEx_Accept; } - if(g_Plugin_GFLClanru) + if(g_Plugin_UNLOZE) { DataPack pack = new DataPack(); pack.WriteCell(admin); diff --git a/SelfMute/scripting/SelfMute.sp b/SelfMute/scripting/SelfMute.sp index 66fc309a..a17d9985 100644 --- a/SelfMute/scripting/SelfMute.sp +++ b/SelfMute/scripting/SelfMute.sp @@ -102,6 +102,9 @@ public void OnAllPluginsLoaded() (g_Extension_Voice ? "loaded" : "not loaded")); } +public void OnLibraryAdded(const char[] name) { OnAllPluginsLoaded(); } +public void OnLibraryRemoved(const char[] name) { OnAllPluginsLoaded(); } + public void OnClientPutInServer(int client) { g_SpecialMutes[client] = MUTE_NONE; diff --git a/UNLOZE_ForumIntegration/scripting/UNLOZE_ForumIntegration.sp b/UNLOZE_ForumIntegration/scripting/UNLOZE_ForumIntegration.sp index 62e2cbf2..cf52dd29 100644 --- a/UNLOZE_ForumIntegration/scripting/UNLOZE_ForumIntegration.sp +++ b/UNLOZE_ForumIntegration/scripting/UNLOZE_ForumIntegration.sp @@ -57,7 +57,7 @@ public void OnPluginStart() //---------------------------------------------------------------------------------------------------- public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { - CreateNative("HasSteamIDReservedSlot", Native_HasSteamIDReservedSlot); + CreateNative("AsyncHasSteamIDReservedSlot", Native_AsyncHasSteamIDReservedSlot); RegPluginLibrary("unloze"); @@ -242,12 +242,12 @@ stock void ApplyGroupFlags(int client) //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- -public int Native_HasSteamIDReservedSlot(Handle plugin, int numParams) +public int Native_AsyncHasSteamIDReservedSlot(Handle plugin, int numParams) { char sSteamID32[32]; GetNativeString(1, sSteamID32, sizeof(sSteamID32)); - HasSteamIDReservedSlotCallback callback; + AsyncHasSteamIDReservedSlotCallbackFunc callback; callback = GetNativeCell(2); any data; @@ -267,7 +267,7 @@ public int Native_HasSteamIDReservedSlot(Handle plugin, int numParams) Handle hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET, sRequest); if (!hRequest || - !SteamWorks_SetHTTPCallbacks(hRequest, Native_HasSteamIDReservedSlot_OnTransferComplete) || + !SteamWorks_SetHTTPCallbacks(hRequest, Native_AsyncHasSteamIDReservedSlot_OnTransferComplete) || !SteamWorks_SetHTTPRequestContextValue(hRequest, hDataPack) || !SteamWorks_SendHTTPRequest(hRequest)) { @@ -278,32 +278,32 @@ public int Native_HasSteamIDReservedSlot(Handle plugin, int numParams) //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- -public int Native_HasSteamIDReservedSlot_OnTransferComplete(Handle hRequest, bool bFailure, bool bSuccessful, EHTTPStatusCode eStatusCode, DataPack hDataPack) +public int Native_AsyncHasSteamIDReservedSlot_OnTransferComplete(Handle hRequest, bool bFailure, bool bSuccessful, EHTTPStatusCode eStatusCode, DataPack hDataPack) { if (bFailure || !bSuccessful || eStatusCode != k_EHTTPStatusCode200OK) { char sData[32] = "NOGROUP"; - Native_HasSteamIDReservedSlot_OnTransferResponse(sData, hDataPack); + Native_AsyncHasSteamIDReservedSlot_OnTransferResponse(sData, hDataPack); delete hRequest; return; } - SteamWorks_GetHTTPResponseBodyCallback(hRequest, Native_HasSteamIDReservedSlot_OnTransferResponse, hDataPack); + SteamWorks_GetHTTPResponseBodyCallback(hRequest, Native_AsyncHasSteamIDReservedSlot_OnTransferResponse, hDataPack); } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- -public int Native_HasSteamIDReservedSlot_OnTransferResponse(char[] sData, DataPack hDataPack) +public int Native_AsyncHasSteamIDReservedSlot_OnTransferResponse(char[] sData, DataPack hDataPack) { hDataPack.Reset(); char sSteamID32[32]; hDataPack.ReadString(sSteamID32, sizeof(sSteamID32)); - HasSteamIDReservedSlotCallback callback; - callback = view_as(hDataPack.ReadFunction()); + AsyncHasSteamIDReservedSlotCallbackFunc callback; + callback = view_as(hDataPack.ReadFunction()); Handle plugin; plugin = hDataPack.ReadCell(); diff --git a/includes/GFLClanru.inc b/includes/GFLClanru.inc deleted file mode 100644 index 7af00d03..00000000 --- a/includes/GFLClanru.inc +++ /dev/null @@ -1,30 +0,0 @@ -#if defined _GFLClanru_Included - #endinput -#endif -#define _GFLClanru_Included - -typeset AsyncHasSteamIDReservedSlotCallbackFunc -{ - function void (const char[] sSteam32ID, int Result); - function void (const char[] sSteam32ID, int Result, any Data); -}; - -native void AsyncHasSteamIDReservedSlot(const char[] sSteam32ID, AsyncHasSteamIDReservedSlotCallbackFunc Callback, any Data = 0); - -public SharedPlugin __pl_GFLClanru = -{ - name = "GFLClanru", - file = "GFLClanru.smx", -#if defined REQUIRE_PLUGIN - required = 1, -#else - required = 0, -#endif -}; - -#if !defined REQUIRE_PLUGIN -public __pl_GFLClanru_SetNTVOptional() -{ - MarkNativeAsOptional("AsyncHasSteamIDReservedSlot"); -} -#endif diff --git a/includes/unloze.inc b/includes/unloze.inc index e8272450..c5ab0178 100644 --- a/includes/unloze.inc +++ b/includes/unloze.inc @@ -1,19 +1,19 @@ -#if defined _unloze_ForumIntegration_Included +#if defined _UNLOZE_ForumIntegration_Included #endinput #endif -#define _unloze_ForumIntegration_Included +#define _UNLOZE_ForumIntegration_Included -typeset HasSteamIDReservedSlotCallback +typeset AsyncHasSteamIDReservedSlotCallbackFunc { function void (const char[] sSteam32ID, int Result); function void (const char[] sSteam32ID, int Result, any Data); }; -native void HasSteamIDReservedSlot(const char[] sSteam32ID, HasSteamIDReservedSlotCallback Callback, any Data = 0); +native void AsyncHasSteamIDReservedSlot(const char[] sSteam32ID, AsyncHasSteamIDReservedSlotCallbackFunc Callback, any Data = 0); -public SharedPlugin __pl_unloze_ForumIntegration = +public SharedPlugin __pl_UNLOZE_ForumIntegration = { - name = "UNLOZE Forum Integration", + name = "UNLOZE_ForumIntegration", file = "UNLOZE_ForumIntegration.smx", #if defined REQUIRE_PLUGIN required = 1, @@ -23,8 +23,8 @@ public SharedPlugin __pl_unloze_ForumIntegration = }; #if !defined REQUIRE_PLUGIN -public __pl_UNLOZE Forum Integration_SetNTVOptional() +public __pl_UNLOZE_ForumIntegration_SetNTVOptional() { - MarkNativeAsOptional("HasSteamIDReservedSlot"); + MarkNativeAsOptional("AsyncHasSteamIDReservedSlot"); } -#endif \ No newline at end of file +#endif