05.03.2016, 06:58
That loop can easily be optimised as follows:
In this slightly optimised loop above, the function 'GetPlayerPoolSize()' will not be called every single iteration. It is called upon creating j -- which is when the loop is initialised -- and therefore will improve its performance. It's an easy optimisation and a good habit.
It's redundant when you have only one loop in your script, but imagine a gamemode with hundreds if not thousands of unoptimised loops.
PHP код:
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
It's redundant when you have only one loop in your script, but imagine a gamemode with hundreds if not thousands of unoptimised loops.