Simple question... I'm wondering what would be the more efficient/effective method of using a continually looped task.
Using set_task() on a loop...
Code:
public plugin_init( )
{
set_task( 1.0, "TaskUpdateList", _, _, _, "b" );
set_task( 0.1, "TaskUpdateKeys", _, _, _, "b" );
}
public TaskUpdateList( )
{
}
public TaskUpdateKeys( )
{
}
Or using something else, perhaps server_frame(), and using a global variable to check if some code should be executed:
Code:
new Float:g_fNextUpdate_Keys;
new Float:g_fNextUpdate_List;
public server_frame()
{
static Float:fGlobalTime;
fGlobalTime = get_gametime( );
if( g_fNextUpdate_Keys >= fGameTime )
{
//execute code...
g_fNextUpdate_Keys = fGameTime + 0.1;
}
if( g_fNextUpdate_List >= fGameTime )
{
//execute code...
g_fNextUpdate_List = fGameTime + 0.1;
}
}