ExtraCommands: Make OutputInfo optional.

This commit is contained in:
zaCade 2022-12-07 14:44:40 +01:00
parent 2367266604
commit 9aefd25b20

View File

@ -4,11 +4,16 @@
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <outputinfo>
#include <halflife>
#undef REQUIRE_EXTENSIONS
#tryinclude <outputinfo>
#define REQUIRE_EXTENSIONS
#pragma newdecls required
bool g_Extension_OutputInfo = false;
bool g_bInBuyZoneAll = false;
bool g_bInBuyZone[MAXPLAYERS + 1] = {false, ...};
@ -84,6 +89,26 @@ public void OnPluginStart()
}
}
public void OnAllPluginsLoaded()
{
g_Extension_OutputInfo = LibraryExists("OutputInfo");
LogMessage("ExtraCommands capabilities:\nOutputInfo: %s",
(g_Extension_OutputInfo ? "loaded" : "not loaded"));
}
public void OnLibraryAdded(const char[] name)
{
if(StrEqual(name, "OutputInfo"))
g_Extension_OutputInfo = true;
}
public void OnLibraryRemoved(const char[] name)
{
if(StrEqual(name, "OutputInfo"))
g_Extension_OutputInfo = false;
}
public void OnMapStart()
{
g_bInBuyZoneAll = false;
@ -1213,6 +1238,8 @@ stock void WAILA(int client, int iEntity)
PrintToConsole(client, "Entity Index: %i\nOrigin: %.f %.f %.f\nHammer ID: %d\nTarget name: %s\nModel Path: %s\nModel Index: %i\nClass Name: %s\nNet Class Name: %s",
iEntity, fvecOrigin[0], fvecOrigin[1], fvecOrigin[2], iHammerID, sTargetname, sModelPath, iEntityModelIdx, sClsName, sNetClsName);
if(g_Extension_OutputInfo)
{
char sOutputName[128];
for(int index = 0; ; index++)
{
@ -1229,6 +1256,7 @@ stock void WAILA(int client, int iEntity)
PrintToConsole(client, "%s: %s", sOutputName, sFormatted);
}
}
}
PrintToConsole(client, "-----");
}