Quote:
Originally Posted by LenHard
PHP Code:
char[] sWeapon = new char[MAX_NAME_LENGTH];
for (int i = MaxClients; i < GetMaxEntities(); ++i)
{
if (IsValidEdict(i))
{
GetEdictClassname(i, sWeapon, MAX_NAME_LENGTH);
if (StrContains(sWeapon, "weapon_") != -1)
AcceptEntityInput(i, "Kill");
}
}
|
if you really want to loop all weapons, you can save yourself some cpu time using FindEntityByClassname with a wildcard.
PHP Code:
int ent = -1;
while ((ent = FindEntityByClassname("weapon_*") != -1)
{
AcceptEntityInput(ent, "Kill");
}