Raised This Month: $ Target: $400
 0% 

entity purge howto


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
alien
Senior Member
Join Date: Aug 2005
Location: London || Slovakia
Old 04-30-2006 , 01:51   entity purge howto
Reply With Quote #1

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.
alien is offline
Send a message via ICQ to alien
 



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