Skip to content

Commit

Permalink
Change method to remove knife
Browse files Browse the repository at this point in the history
  • Loading branch information
Bara committed Dec 8, 2017
1 parent 862a872 commit ca13898
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
32 changes: 29 additions & 3 deletions addons/sourcemod/scripting/ttt/ttt.sp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,16 +1209,42 @@ stock void TeamInitialize(int client)
}
else
{
char sBuffer[32];
int iEnt;
/* char sBuffer[32];
int iEnt = -1;
while ((iEnt = GetPlayerWeaponSlot(client, CS_SLOT_KNIFE)) != -1)
{
GetEntityClassname(iEnt, sBuffer, sizeof(sBuffer));
if (StrContains(sBuffer, "knife", false) != -1 || StrContains(sBuffer, "bayonet", false) != -1)
{
TTT_SafeRemoveWeapon(client, iEnt, CS_SLOT_KNIFE);
if (!TTT_SafeRemoveWeapon(client, iEnt, CS_SLOT_KNIFE))
{
LogError("Can't remove knife! Player: \"%L\"", client);
}
break;
}
} */

for(int offset = 0; offset < 128; offset += 4)
{
int weapon = GetEntDataEnt2(client, FindSendPropInfo("CBasePlayer", "m_hMyWeapons") + offset);

if (IsValidEntity(weapon))
{
char sClass[32];
GetEntityClassname(weapon, sClass, sizeof(sClass));

if ((StrContains(sClass, "knife", false) != -1) || (StrContains(sClass, "bayonet", false) != -1))
{
if (!TTT_SafeRemoveWeapon(client, weapon, CS_SLOT_KNIFE))
{
LogError("Can't remove knife! Player: \"%L\"", client);
}

break;
}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion addons/sourcemod/scripting/ttt/ttt_knockout.sp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,10 @@ stock void DropWeapons(int client)

if ((StrContains(sClass, "knife", false) != -1) || (StrContains(sClass, "bayonet", false) != -1))
{
TTT_SafeRemoveWeapon(client, weapon, CS_SLOT_KNIFE);
if (!TTT_SafeRemoveWeapon(client, weapon, CS_SLOT_KNIFE))
{
LogError("Can't remove knife! Player: \"%L\"", client);
}
}
else
{
Expand Down

0 comments on commit ca13898

Please sign in to comment.