Raised This Month: $ Target: $400
 0% 

View Poll Results: Wich of this options is better at the moment of call a function very often?
simple set_task at 0.1 in the called funcion.. 1 8.33%
infinite set_task (and then remove it out) (id, _, _, "b") 2 16.67%
Client_prethink 4 33.33%
fm_prethink 3 25.00%
ham_prethink 2 16.67%
Voters: 12. You may not vote on this poll

Optimizing a plugin.Wich of these options is better?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-14-2009 , 21:11   Re: Optimizing a plugin.Wich of these options is better?
Reply With Quote #1

Quote:
Originally Posted by _lol_ View Post
well, i only want to know which is the better and appropriate
None.

Set a thinking entity with a custom class name, using engine:

PHP Code:
new Float:handlerThinkDelay 2.0

new handlerClassName[] = "someName";

register_think(handlerClassName,"handlerThink");    

new 
handlerEntity create_entity("info_target")  
entity_set_string(sprite,EV_SZ_classname,handlerClassName);
entity_set_float(sprite,EV_FL_nextthinkget_gametime() + handlerThinkDelay);

public 
handlerThink(id)
{
    
entity_set_float(sprite,EV_FL_nextthinkget_gametime() + handlerThinkDelay);

I don't know, and I can't prove it but, i think it's better than using a fakemeta approach but, you can use also FM_Think.

Edit:

Be aware that it depends on each case. Tell the exactly situation since probably it can be found a better way to handle it.
__________________

Last edited by joaquimandrade; 04-14-2009 at 21:15.
joaquimandrade is offline
Reply



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 02:21.


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