View Single Post
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 07-16-2019 , 17:06   Re: [HELP] help with int, for loop...
Reply With Quote #12

LMAO. Doesnt think optimisation is a big deal.

There have been numerous threads around the bad habit of a ValidClient function.

Just dont be lazy!

Code:
public void PrintScores() 
{ 
    int i_CTCount, i_TCount; 
     
    for (int i = 1; i <= MaxClients; i++) 
    {     
        if (!IsClientInGame(i))
            continue;

        if (IsFakeClient(i))
            continue;

        if(GetClientTeam(i) == 2) // Terror 
            i_TCount += g_playerspoints[i]; 
             
        if(GetClientTeam(i) == 3) // CT 
            i_CTCount += g_playerspoints[i]; 
    } 

    PrintToChatAll("Team Terror has total %d points.", i_TCount); 
    PrintToChatAll("Team CT has total %d points.", i_CTCount); 
}
__________________

Last edited by Neuro Toxin; 07-17-2019 at 16:34.
Neuro Toxin is offline