Permalink
Browse files

Fix Melee Weapons

  • Loading branch information...
Bara committed Dec 8, 2018
1 parent f28f88d commit ba053184d4b45e4e7654fb05d46c3544f1adc8d2
Showing with 23 additions and 4 deletions.
  1. +17 −1 addons/sourcemod/scripting/tests/commands.sp
  2. +6 −3 addons/sourcemod/scripting/ttt/ttt_weapons.sp
@@ -15,6 +15,7 @@ public void OnPluginStart()
RegConsoleCmd("sm_hud", Command_HUD);
RegConsoleCmd("sm_endround", Command_EndRound);
RegConsoleCmd("sm_give", Command_Give);
RegConsoleCmd("sm_givee", Command_GiveE);
RegConsoleCmd("sm_roundtime", Command_RoundTime);
RegConsoleCmd("sm_stone", Command_Stone);
RegConsoleCmd("sm_ghost", Command_Ghost);
@@ -115,7 +116,6 @@ public Action Command_EndRound(int client, int args)
return Plugin_Handled;
}


public Action Command_Give(int client, int args)
{
if (args != 1)
@@ -133,6 +133,22 @@ public Action Command_Give(int client, int args)
return Plugin_Handled;
}

public Action Command_GiveE(int client, int args)
{
if (args != 1)
{
ReplyToCommand(client, "sm_givee <weapon>");
return Plugin_Handled;
}

char sArg[32];
GetCmdArg(1, sArg, sizeof(sArg));
Format(sArg, sizeof(sArg), "weapon_%s", sArg);
GivePlayerItem(client, sArg);

return Plugin_Handled;
}

public Action Command_RoundTime(int client, int args)
{
int time = GameRules_GetProp("m_iRoundTime");
@@ -467,7 +467,8 @@ public Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count
return Plugin_Stop;
}

GivePlayerItem(client, "weapon_hammer");
int iMelee = GivePlayerItem(client, "weapon_hammer");
EquipPlayerWeapon(client, iMelee);
}
else if(strcmp(itemshort, AXE_ITEM_SHORT, false) == 0)
{
@@ -476,7 +477,8 @@ public Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count
return Plugin_Stop;
}

GivePlayerItem(client, "weapon_axe");
int iMelee = GivePlayerItem(client, "weapon_axe");
EquipPlayerWeapon(client, iMelee);
}
else if(strcmp(itemshort, SPANNER_ITEM_SHORT, false) == 0)
{
@@ -485,7 +487,8 @@ public Action TTT_OnItemPurchased(int client, const char[] itemshort, bool count
return Plugin_Stop;
}

GivePlayerItem(client, "weapon_spanner");
int iMelee = GivePlayerItem(client, "weapon_spanner");
EquipPlayerWeapon(client, iMelee);
}
else if(strcmp(itemshort, M4_ITEM_SHORT, false) == 0)
{

0 comments on commit ba05318

Please sign in to comment.