Skip to content

Commit

Permalink
Fix Melee Weapons
Browse files Browse the repository at this point in the history
  • Loading branch information
Bara committed Dec 8, 2018
1 parent f28f88d commit ba05318
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
18 changes: 17 additions & 1 deletion addons/sourcemod/scripting/tests/commands.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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");
Expand Down
9 changes: 6 additions & 3 deletions addons/sourcemod/scripting/ttt/ttt_weapons.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand All @@ -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)
{
Expand Down

0 comments on commit ba05318

Please sign in to comment.