Permalink
Browse files

Add hammer item

  • Loading branch information...
Bara committed Dec 7, 2018
1 parent d4a6d09 commit 47e905822f0d4512c8859bb2b2060d34eaa1c1b8
@@ -29,3 +29,4 @@
#define DEAGLE_ITEM_SHORT "deagle"
#define REVOLVER_ITEM_SHORT "revolver"
#define SCOUT_ITEM_SHORT "sg008"
#define HAMMER_ITEM_SHORT "hammer"
@@ -35,6 +35,7 @@ ConVar g_cAK_Long = null;
ConVar g_cDeagle_Long = null;
ConVar g_cRevolver_Long = null;
ConVar g_cScout_Long = null;
ConVar g_cHammer_Long = null;
ConVar g_cKev_Type = null;
ConVar g_cKev_Price = null;
ConVar g_cHeavy_Type = null;
@@ -72,6 +73,8 @@ ConVar g_cRevolver_Prio = null;
ConVar g_cRevolver_Price = null;
ConVar g_cScout_Prio = null;
ConVar g_cScout_Price = null;
ConVar g_cHammer_Prio = null;
ConVar g_cHammer_Price = null;

bool g_bHasKnife[MAXPLAYERS + 1] = { false, ... };

@@ -122,6 +125,8 @@ public void OnPluginStart()
g_cRevolver_Prio = AutoExecConfig_CreateConVar("revolver_sort_prio", "0", "The sorting priority of the Revolver in the shop menu.");
g_cScout_Price = AutoExecConfig_CreateConVar("scout_price", "3000", "The amount of credits the Scout costs. 0 to disable.");
g_cScout_Prio = AutoExecConfig_CreateConVar("scout_sort_prio", "0", "The sorting priority of the Scout in the shop menu.");
g_cHammer_Price = AutoExecConfig_CreateConVar("hammer_price", "3000", "The amount of credits the Hammer costs. 0 to disable.");
g_cHammer_Prio = AutoExecConfig_CreateConVar("hammer_sort_prio", "0", "The sorting priority of the Hammer in the shop menu.");
g_cM4_Price = AutoExecConfig_CreateConVar("m4a1_price", "3000", "The amount of credits the M4A1-S costs. 0 to disable.");
g_cM4_Prio = AutoExecConfig_CreateConVar("m4a1_sort_prio", "0", "The sorting priority of the M4A1-S in the shop menu.");
g_cAWP_Price = AutoExecConfig_CreateConVar("awp_price", "3000", "The amount of credits the AWP costs. 0 to disable.");
@@ -141,6 +146,7 @@ public void OnPluginStart()
g_cDeagle_Long = AutoExecConfig_CreateConVar("deagle_name", "Deagle", "The name of the Deagle in the shop menu.");
g_cRevolver_Long = AutoExecConfig_CreateConVar("revolver_name", "Revolver", "The name of the Revolver in the shop menu.");
g_cScout_Long = AutoExecConfig_CreateConVar("scout_name", "Scout", "The name of the Scout in the shop menu.");
g_cHammer_Long = AutoExecConfig_CreateConVar("hammer_name", "Hammer", "The name of the Hammer in the shop menu.");
g_cM4_Long = AutoExecConfig_CreateConVar("m4a1_name", "M4A1-S", "The name of the M4A1-S in the shop menu.");
g_cAWP_Long = AutoExecConfig_CreateConVar("awp_name", "AWP", "The name of the AWP in the shop menu.");
g_cKF_Long = AutoExecConfig_CreateConVar("oneknife_name", "1-Hit Knife", "The name of the 1-hit knife in the shop menu.");
@@ -265,6 +271,9 @@ void RegisterItem()

g_cScout_Long.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(SCOUT_ITEM_SHORT, sBuffer, g_cScout_Price.IntValue, TTT_TEAM_TRAITOR, g_cScout_Prio.IntValue);

g_cHammer_Long.GetString(sBuffer, sizeof(sBuffer));
TTT_RegisterCustomItem(HAMMER_ITEM_SHORT, sBuffer, g_cHammer_Price.IntValue, TTT_TEAM_TRAITOR, g_cHammer_Prio.IntValue);
}

public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
@@ -378,6 +387,15 @@ public Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count

GivePlayerItem(client, "weapon_ssg08");
}
else if(strcmp(itemshort, HAMMER_ITEM_SHORT, false) == 0)
{
if (TTT_GetClientRole(client) != TTT_TEAM_TRAITOR)
{
return Plugin_Stop;
}

GivePlayerItem(client, "weapon_hammer");
}
else if(strcmp(itemshort, M4_ITEM_SHORT, false) == 0)
{
if (TTT_GetClientRole(client) != TTT_TEAM_TRAITOR)

0 comments on commit 47e9058

Please sign in to comment.