Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/Bara/TroubleinTerroristTown

  • Loading branch information...
Bara committed Aug 28, 2019
2 parents 84df887 + 0897493 commit 853dca7eeb03145b53ee4b1f490d08205c7447f7
Showing with 114 additions and 11 deletions.
  1. +88 −0 addons/sourcemod/scripting/ttt/ttt_buyRoles.sp
  2. +26 −11 addons/sourcemod/scripting/ttt/ttt_icon.sp
@@ -10,22 +10,38 @@
#define PLUGIN_NAME TTT_PLUGIN_NAME ... " - Buy Roles"

#define T_SHORT_NAME "buyTRole"
#define T_SHORT_NAME_D "buyTRole_D"
#define T_SHORT_NAME_T "buyTRole_T"
#define TI_SHORT_NAME "buyTiRole"

#define D_SHORT_NAME "buyCTRole"
#define D_SHORT_NAME_D "buyCTRole_D"
#define D_SHORT_NAME_T "buyCTRole_T"
#define DI_SHORT_NAME "buyCTiRole"

ConVar g_cTPrice = null;
ConVar g_cTPrio = null;
ConVar g_cTPrice_D = null;
ConVar g_cTPrio_D = null;
ConVar g_cTPrice_T = null;
ConVar g_cTPrio_T = null;
ConVar g_cTiPrice = null;
ConVar g_cTiPrio = null;
ConVar g_cDPrice = null;
ConVar g_cDPrio = null;
ConVar g_cDPrice_D = null;
ConVar g_cDPrio_D = null;
ConVar g_cDPrice_T = null;
ConVar g_cDPrio_T = null;
ConVar g_cDiPrice = null;
ConVar g_cDiPrio = null;
ConVar g_cTLongName = null;
ConVar g_cTLongName_D = null;
ConVar g_cTLongName_T = null;
ConVar g_cTiLongName = null;
ConVar g_cDLongName = null;
ConVar g_cDLongName_D = null;
ConVar g_cDLongName_T = null;
ConVar g_cDiLongName = null;

public Plugin myinfo =
@@ -44,16 +60,28 @@ public void OnPluginStart()
TTT_StartConfig("buyroles");
CreateConVar("ttt2_buy_roles_version", TTT_PLUGIN_VERSION, TTT_PLUGIN_DESCRIPTION, FCVAR_NOTIFY | FCVAR_DONTRECORD | FCVAR_REPLICATED);
g_cTLongName = AutoExecConfig_CreateConVar("buyroles_traitor_name", "Buy Traitor Role", "The name of the buy traitor role in the Shop");
g_cTLongName_D = AutoExecConfig_CreateConVar("buyroles_traitor_d_name", "Buy Traitor Role", "[Detective] The name of the buy traitor role in the Shop");
g_cTLongName_T = AutoExecConfig_CreateConVar("buyroles_traitor_t_name", "Buy Traitor Role", "[Traitor] The name of the buy traitor role in the Shop");
g_cTiLongName = AutoExecConfig_CreateConVar("buyroles_traitor_instantly_name", "Buy Traitor Role Instantly", "The name of the buy traitor role in the Shop");
g_cDLongName = AutoExecConfig_CreateConVar("buyroles_detective_name", "Buy Detective Role", "The name of the buy detective role in the Shop");
g_cDLongName_D = AutoExecConfig_CreateConVar("buyroles_detective_d_name", "Buy Detective Role", "[Detective] The name of the buy detective role in the Shop");
g_cDLongName_T = AutoExecConfig_CreateConVar("buyroles_detective_t_name", "Buy Detective Role", "[Traitor] The name of the buy detective role in the Shop");
g_cDiLongName = AutoExecConfig_CreateConVar("buyroles_detective_instantly_name", "Buy Detective Role Instantly", "The name of the buy detective role in the Shop");
g_cTPrice = AutoExecConfig_CreateConVar("buyroles_traitor_price", "9000", "The amount of credits that cost to buy the traitor role. 0 to disable.");
g_cTPrice_D = AutoExecConfig_CreateConVar("buyroles_traitor_d_price", "9000", "[Detective] The amount of credits that cost to buy the traitor role. 0 to disable.");
g_cTPrice_T = AutoExecConfig_CreateConVar("buyroles_traitor_t_price", "9000", "[Traitor] The amount of credits that cost to buy the traitor role. 0 to disable.");
g_cTiPrice = AutoExecConfig_CreateConVar("buyroles_traitor_instantly_price", "40000", "The amount of credits that cost to buy the traitor instantly role. 0 to disable.");
g_cDPrice = AutoExecConfig_CreateConVar("buyroles_detective_price", "9000", "The amount of credits that cost to buy the detective role. 0 to disable.");
g_cDPrice_D = AutoExecConfig_CreateConVar("buyroles_detective_d_price", "9000", "[Detective] The amount of credits that cost to buy the detective role. 0 to disable.");
g_cDPrice_T = AutoExecConfig_CreateConVar("buyroles_detective_t_price", "9000", "[Traitor] The amount of credits that cost to buy the detective role. 0 to disable.");
g_cDiPrice = AutoExecConfig_CreateConVar("buyroles_detective_instantly_price", "10000", "The amount of credits that cost to buy the detective instantly role. 0 to disable.");
g_cTPrio = AutoExecConfig_CreateConVar("buyroles_traitor_prio", "0", "The sorting priority of the buy traitor role in the shop menu.");
g_cTPrio_D = AutoExecConfig_CreateConVar("buyroles_traitor_d_prio", "0", "[Detective] The sorting priority of the buy traitor role in the shop menu.");
g_cTPrio_T = AutoExecConfig_CreateConVar("buyroles_traitor_t_prio", "0", "[Traitor] The sorting priority of the buy traitor role in the shop menu.");
g_cTiPrio = AutoExecConfig_CreateConVar("buyroles_traitor_instantly_prio", "0", "The sorting priority of the buy traitor instantly role in the shop menu.");
g_cDPrio = AutoExecConfig_CreateConVar("buyroles_detective_prio", "0", "The sorting priority of the buy detective role in the shop menu.");
g_cDPrio_D = AutoExecConfig_CreateConVar("buyroles_detective_d_prio", "0", "[Detective] The sorting priority of the buy detective role in the shop menu.");
g_cDPrio_T = AutoExecConfig_CreateConVar("buyroles_detective_t_prio", "0", "[Traitor] The sorting priority of the buy detective role in the shop menu.");
g_cDiPrio = AutoExecConfig_CreateConVar("buyroles_detective_instantly_prio", "0", "The sorting priority of the buy detective instantly role in the shop menu.");
TTT_EndConfig();
}
@@ -75,12 +103,24 @@ void RegisterItem()
g_cTLongName.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(T_SHORT_NAME, sBuffer, g_cTPrice.IntValue, TTT_TEAM_INNOCENT, g_cTPrio.IntValue);

g_cTLongName_D.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(T_SHORT_NAME_D, sBuffer, g_cTPrice_D.IntValue, TTT_TEAM_DETECTIVE, g_cTPrio_D.IntValue);

g_cTLongName_T.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(T_SHORT_NAME_T, sBuffer, g_cTPrice_T.IntValue, TTT_TEAM_TRAITOR, g_cTPrio_T.IntValue);

g_cTiLongName.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(TI_SHORT_NAME, sBuffer, g_cTiPrice.IntValue, TTT_TEAM_INNOCENT, g_cTiPrio.IntValue);

g_cDLongName.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(D_SHORT_NAME, sBuffer, g_cDPrice.IntValue, TTT_TEAM_INNOCENT, g_cDPrio.IntValue);

g_cDLongName_D.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(D_SHORT_NAME_D, sBuffer, g_cDPrice_D.IntValue, TTT_TEAM_DETECTIVE, g_cDPrio_D.IntValue);

g_cDLongName_T.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(D_SHORT_NAME_T, sBuffer, g_cDPrice_T.IntValue, TTT_TEAM_TRAITOR, g_cDPrio_T.IntValue);

g_cDiLongName.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(DI_SHORT_NAME, sBuffer, g_cDiPrice.IntValue, TTT_TEAM_INNOCENT, g_cDiPrio.IntValue);
}
@@ -101,6 +141,30 @@ public Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count
if(!TTT_ForceDetective(client))
return Plugin_Stop;
}
if (StrEqual(itemshort, D_SHORT_NAME_D, false))
{
int role = TTT_GetClientRole(client);

if (role != TTT_TEAM_DETECTIVE)
{
return Plugin_Stop;
}

if(!TTT_ForceDetective(client))
return Plugin_Stop;
}
if (StrEqual(itemshort, D_SHORT_NAME_T, false))
{
int role = TTT_GetClientRole(client);

if (role != TTT_TEAM_TRAITOR)
{
return Plugin_Stop;
}

if(!TTT_ForceDetective(client))
return Plugin_Stop;
}
else if (StrEqual(itemshort, T_SHORT_NAME, false))
{
int role = TTT_GetClientRole(client);
@@ -113,6 +177,30 @@ public Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count
if(!TTT_ForceTraitor(client))
return Plugin_Stop;
}
else if (StrEqual(itemshort, T_SHORT_NAME_D, false))
{
int role = TTT_GetClientRole(client);

if (role != TTT_TEAM_DETECTIVE)
{
return Plugin_Stop;
}

if(!TTT_ForceTraitor(client))
return Plugin_Stop;
}
else if (StrEqual(itemshort, T_SHORT_NAME_T, false))
{
int role = TTT_GetClientRole(client);

if (role != TTT_TEAM_TRAITOR)
{
return Plugin_Stop;
}

if(!TTT_ForceTraitor(client))
return Plugin_Stop;
}
else if (StrEqual(itemshort, DI_SHORT_NAME, false))
{
int role = TTT_GetClientRole(client);
@@ -69,22 +69,33 @@ public void OnMapStart()
char sBuffer[PLATFORM_MAX_PATH];

g_cTraitorIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
if (strlen(sBuffer) > 0)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
}

g_cTraitorIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(sBuffer);

if (strlen(sBuffer) > 0)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(sBuffer);
}
g_cDetectiveIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
if (strlen(sBuffer) > 0)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vtf", sBuffer);
AddFileToDownloadsTable(sBuffer);
}

g_cDetectiveIcon.GetString(sBuffer, sizeof(sBuffer));
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(sBuffer);
if (strlen(sBuffer) > 0)
{
Format(sBuffer, sizeof(sBuffer), "materials/%s.vmt", sBuffer);
AddFileToDownloadsTable(sBuffer);
PrecacheModel(sBuffer);
}
}

public void OnClientDisconnect(int client)
@@ -187,11 +198,15 @@ int CreateIcon(int client, int role)
if (role == TTT_TEAM_DETECTIVE)
{
g_cDetectiveIcon.GetString(sBuffer, sizeof(sBuffer));
if (strlen(sBuffer) == 0)
return -1;
Format(sBuffer, sizeof(sBuffer), "%s.vmt", sBuffer);
}
else if (role == TTT_TEAM_TRAITOR)
{
g_cTraitorIcon.GetString(sBuffer, sizeof(sBuffer));
if (strlen(sBuffer) == 0)
return -1;
Format(sBuffer, sizeof(sBuffer), "%s.vmt", sBuffer);
}

0 comments on commit 853dca7

Please sign in to comment.
You can’t perform that action at this time.