Raised This Month: $ Target: $400
 0% 

entity purge howto


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
VEN
Veteran Member
Join Date: Jan 2005
Old 05-02-2006 , 13:02  
Reply With Quote #8

Max entities global should be used instead of entity_count

weaponbox also "contain" weapon_* entity which should be removed too in other case here is a chance of edict overflow.

Should be: for (new i = get_maxplayers() + 1 ...

Should be: while((ent = find_ent_by_class...

Here is the correct way:
Code:
new wprefix[] = "weapon_", class[11] new wbox, wbox_class[] = "weaponbox" new startent = get_maxplayers() + 1 new maxents = get_global_int(GL_maxEntities) for (new i = startent; i <= maxents; ++i) {     if (!is_valid_ent(i))         continue     entity_get_string(i, EV_SZ_classname, class, 7)     if (!equal(class, wprefix))         continue     wbox = entity_get_edict(i, EV_ENT_owner)     if (wbox < startent || !is_valid_ent(wbox))         continue     entity_get_string(wbox, EV_SZ_classname, class, 10)     if (!equal(class, wbox_class))         continue     kill_entity(wbox)     kill_entity(i) } stock kill_entity(id) {     entity_set_int(id, EV_INT_flags, (entity_get_int(id, EV_INT_flags) | FL_KILLME)) }
VEN is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode