Hi,
i'm interested in periodical purging of dropped weapons (esp. USP & scouts).
Code:
public repeat_purge()
{
new n = entity_count()
new class_name[32]
client_print(0, print_chat, "[%s] Purging unused entities.", PLUGIN_NAME)
for (new i = 0; i < n; i++)
{
if (is_valid_ent(i))
{
entity_get_string(i, EV_SZ_classname, class_name, 31)
if
(
equal(class_name, "weaponbox") ||
(equal(class_name, "weapon_usp") && entity_get_int(i, EV_INT_movetype) == 0) ||
(equal(class_name, "weapon_scout") && entity_get_int(i, EV_INT_movetype) == 0)
)
remove_entity(i)
}
}
}
It makes server failing cca. every half an hour. Is this a right way to do this? And i'm not sure, whether it's right, do distinguish dropped weapons from those carried by EV_INT_movetype flag. Could you help me?
Thank you.
Al.