Permalink
Browse files

Update error message (missing core plugin)

  • Loading branch information...
Bara committed May 14, 2018
1 parent cb14f50 commit 4dfef0f92a8544071d7cf0b1cedd2e2c6472cb37
Showing with 36 additions and 38 deletions.
  1. +36 −38 addons/sourcemod/scripting/ttt/ttt_turret.sp
@@ -53,6 +53,7 @@ public void OnPluginStart()
TTT_EndConfig();
}
public void OnAllPluginsLoaded()
{
g_cCheckTeam = FindConVar("sd_turret_checkteam");
@@ -64,25 +65,30 @@ public void OnAllPluginsLoaded()
}
}
public void OnConfigsExecuted()
{
RegisterItem();
}
public void ConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
public void TTT_OnItemsReset()
{
if(convar == g_cCheckTeam)
{
g_cCheckTeam.SetInt(3);
}
RegisterItem();
}
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
void RegisterItem()
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (TTT_IsClientValid(client))
{
g_bHasTurret[client] = false;
if(!LibraryExists("TurretCore"))
{
TTT_RemoveCustomItem(SHORT_NAME);
SetFailState("Can't find turret_core.smx! This file will be provided with TTT.");
return;
}
}
char sName[MAX_ITEM_LENGTH];
g_cLongName.GetString(sName, sizeof(sName));
TTT_RegisterCustomItem(SHORT_NAME, sName, g_cPrice.IntValue, TTT_TEAM_TRAITOR, g_cPrio.IntValue, g_cDiscount.BoolValue);
}
public Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count)
{
@@ -118,6 +124,24 @@ public Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count
return Plugin_Continue;
}
public void ConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
if(convar == g_cCheckTeam)
{
g_cCheckTeam.SetInt(3);
}
}
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (TTT_IsClientValid(client))
{
g_bHasTurret[client] = false;
}
}
public void Turret_OnTurretDead(int VictimTurretClientIndex,int AttackerClientIndex)
{
TTT_AddClientCredits(AttackerClientIndex, g_cKillTurretCount.IntValue);
@@ -138,29 +162,3 @@ public void TTT_OnClientGetRole(int client, int role)
}
}
}
public void OnConfigsExecuted()
{
RegisterItem();
}
public void TTT_OnItemsReset()
{
RegisterItem();
}
void RegisterItem()
{
if(!LibraryExists("TurretCore"))
{
LogError("can't find plugin turret_core.smx or turret_core.smx not running! https://forums.alliedmods.net/showpost.php?p=2589375&postcount=2");
return;
}
char sName[MAX_ITEM_LENGTH];
g_cLongName.GetString(sName, sizeof(sName));
TTT_RegisterCustomItem(SHORT_NAME, sName, g_cPrice.IntValue, TTT_TEAM_TRAITOR, g_cPrio.IntValue, g_cDiscount.BoolValue);
}

0 comments on commit 4dfef0f

Please sign in to comment.