Permalink
Browse files

Change method to remove knife

  • Loading branch information...
Bara committed Dec 8, 2017
1 parent 862a872 commit ca13898b64370d9ed9616a7188477047361c349a
Showing with 33 additions and 4 deletions.
  1. +29 −3 addons/sourcemod/scripting/ttt/ttt.sp
  2. +4 −1 addons/sourcemod/scripting/ttt/ttt_knockout.sp
@@ -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;
}
}
}
}
@@ -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
{

0 comments on commit ca13898

Please sign in to comment.