a simple question.
#1

which of these two functions is faster and better, or are they both the same?

1:

PHP код:

if(zGangZones[zoneid][zIsUsingBorders])
    {
       
GangZoneHideForPlayer(playeridzGangZones[zoneid][border][0]);
       
GangZoneHideForPlayer(playeridzGangZones[zoneid][border][1]);
       
GangZoneHideForPlayer(playeridzGangZones[zoneid][border][2]);
       
GangZoneHideForPlayer(playeridzGangZones[zoneid][border][3]);
    } 
or

2:

PHP код:

if(zGangZones[zoneid][zIsUsingBorders])
    {
        for(new 
04i++) {
            
GangZoneHideForPlayer(playeridzGangZones[zoneid][border][i]);
        }
    } 
Reply
#2

I don't know about speed but the second one is better because if in future you want add or delete gang zones, then you will only have to adjust the array.. and also change the "4" to "sizeof(zGangZones[zoneid][border])".
Reply
#3

It will be same. It only makes your code looks better nothing else. What loop does it execute those lines number of times instead of writing it that number of times separately.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)