If you want to block "drop" command then hook it and do your checks. Your way is just removing the box when it is spawned, while you could block it from being created.
Also, don't set FL_KILLME flags on a weaponbox, just make it to think.
Now, about your code:
The classname of an weaponbox entity is, guess what, "weaponbox". pev_classname will always give this in this case. To know if a weaponbox contain a specific weapon you could redo the
CWeaponBox::HasWeapon function
(
https://github.com/Arkshine/CSSDK/bl...pons.cpp#L1641). Or use this stock made by Connor(which is more or less the same thing):
PHP Code:
GetWeaponBoxWeaponType( ent )
{
new weapon;
for(new i = 1; i<= 5; i++)
{
weapon = get_pdata_cbase(ent, m_rgpPlayerItems_CWeaponBox[i], XO_CWEAPONBOX);
if( weapon > 0 )
{
return cs_get_weapon_id(weapon);
}
}
return 0;
}
Then you can do:
PHP Code:
new WeaponId = GetWeaponBoxWeaponType(WeaponBox)
if(WeaponId == CSW_C4)
{
}
__________________