Most efficiently get all user ids
Hi,
I'd like to know how I can fill an array[32] containing valid user ids. Since this code is to be implemented in a callback initialized using set_task(), I need the most efficient way to do this. Would it be faster to... use get_players(), get the highest user ID. On each disconnect, update the table instead of re-using get_players() to re-fill it, using a list of empty indexes (lookup table). On each player connect, consult the lookup table, fill the element corresponding to the retrieved index, delete the index, go to next. Or... simply use get_players() on each iteration? Please advise! Thanks! Misery |
Re: Most efficiently get all user ids
I'll add a few more details...
The function passed to set_task() will loop in the players[32] array. Each iteration, it'll look wether or not the user id retrieved belongs to CT. If so, a command will be executed on the CT player, else nothing will be done. But the user id retrieved must *not* have executed the task function : if a player is in CTs and have executed it, nothing will be done for him. This is why I tought it would be advantageous to update manually the array on each player disconnect/connect, intead of re-invoking get_players(), which could also mess up organization of the array on each iteration - i.e. a user id moved dues to a random sorting. If get_players() do a sort, then this would be different... Thanks! |
Re: Most efficiently get all user ids
Nevermind, this post should just get trashed.
|
| All times are GMT -4. The time now is 02:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.