Permalink
Browse files

Add some log messages to models plugin

  • Loading branch information...
Bara committed Jan 9, 2018
1 parent fb30f99 commit ed27f25025e6bf968deb19a6f6bf21926ac9ca31
Showing with 82 additions and 0 deletions.
  1. +82 −0 addons/sourcemod/scripting/ttt/ttt_models.sp
@@ -14,6 +14,8 @@ bool g_bEnable = false;
int g_iDCount = 0;
int g_ITCount = 0;
ConVar g_cDebug = null;
public Plugin myinfo =
{
name = PLUGIN_NAME,
@@ -28,6 +30,11 @@ public void OnPluginStart()
TTT_IsGameCSGO();
}
public void OnConfigsExecuted()
{
g_cDebug = FindConVar("ttt_debug_mode");
}
public void OnMapStart()
{
if (!FileExists(CONFIG_FILE))
@@ -60,6 +67,11 @@ public void OnMapStart()
Format(sName, sizeof(sName), "DModel%d", i);
KvGetString(hConfig, sName, sBuffer, sizeof(sBuffer));
if (g_cDebug.BoolValue)
{
LogMessage("%s: %s", sName, sBuffer);
}
if (DirExists(sBuffer))
{
@@ -79,18 +91,35 @@ public void OnMapStart()
if (StrContains(sFileName, ".mdl", false) != -1)
{
PrecacheModel(sFileName, true);
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) Precache: %s", sFileName);
}
}
AddFileToDownloadsTable(sFileName);
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) AddDownload: %s", sFileName);
}
}
}
}
delete hModelDir;
}
else
{
LogError("(OnMapStart) Can't find %s dir: %s", sName, sBuffer);
}
Format(sName, sizeof(sName), "DMaterial%d", i);
KvGetString(hConfig, sName, sBuffer, sizeof(sBuffer));
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) %s: %s", sName, sBuffer);
}
if (DirExists(sBuffer))
{
@@ -110,15 +139,27 @@ public void OnMapStart()
if (StrContains(sFileName, ".mdl", false) != -1)
{
PrecacheModel(sFileName, true);
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) Precache: %s", sFileName);
}
}
AddFileToDownloadsTable(sFileName);
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) AddDownload: %s", sFileName);
}
}
}
}
delete hMaterialDir;
}
else
{
LogError("(OnMapStart) Can't find %s dir: %s", sName, sBuffer);
}
}
}
@@ -150,15 +191,27 @@ public void OnMapStart()
if (StrContains(sFileName, ".mdl", false) != -1)
{
PrecacheModel(sFileName, true);
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) Precache: %s", sFileName);
}
}
AddFileToDownloadsTable(sFileName);
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) AddDownload: %s", sFileName);
}
}
}
}
delete hModelDir;
}
else
{
LogError("(OnMapStart) Can't find %s dir: %s", sName, sBuffer);
}
Format(sName, sizeof(sName), "ITMaterial%d", i);
KvGetString(hConfig, sName, sBuffer, sizeof(sBuffer));
@@ -181,15 +234,27 @@ public void OnMapStart()
if (StrContains(sFileName, ".mdl", false) != -1)
{
PrecacheModel(sFileName, true);
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) Precache: %s", sFileName);
}
}
AddFileToDownloadsTable(sFileName);
if (g_cDebug.BoolValue)
{
LogMessage("(OnMapStart) AddDownload: %s", sFileName);
}
}
}
}
delete hMaterialDir;
}
else
{
LogError("(OnMapStart) Can't find %s dir: %s", sName, sBuffer);
}
}
}
}
@@ -255,13 +320,22 @@ void SetModel(int client, int role)
if (StrContains(sFileName, ".mdl", false) != -1)
{
SetEntityModel(client, sFileName);
if (g_cDebug.BoolValue)
{
LogMessage("Player: %N, Model: %s", client, sFileName);
}
}
}
}
}
delete hDir;
}
else
{
LogError("(SetModel) Can't find %s dir: %s", sName, sBuffer);
}
}
if (role == TTT_TEAM_INNOCENT || role == TTT_TEAM_TRAITOR)
@@ -294,13 +368,21 @@ void SetModel(int client, int role)
if (StrContains(sFileName, ".mdl", false) != -1)
{
SetEntityModel(client, sFileName);
if (g_cDebug.BoolValue)
{
LogMessage("Player: %N, Model: %s", client, sFileName);
}
}
}
}
}
delete hDir;
}
else
{
LogError("(SetModel) Can't find %s dir: %s", sName, sBuffer);
}
}
delete hConfig;

0 comments on commit ed27f25

Please sign in to comment.