Checking if no one's player-specific variable is equal to value
#6

Well, first, use GetPlayerPoolSize instead of MAX_PLAYERS, no need to loop through whole 1000 player if they're not connected.
Second, you're making it correct, but return is extra, you don't need that. remove return from code.

so correct code looks like this
PHP Code:
    new TotalWinners 0;
    for(new 
0GetPlayerPoolSize(); <= ji++)
    {
        if(!
IsPlayerConnected(i)) continue; //make loop faster.
        
if(LottoNumber[i] != && LottoNumber[i] != LottoNum//check if they got a wrong number
        
{
            
SendClientMessage(iCOLOR_WHITE"{FFFF00}LOTTO: Unfortunately you haven't won the lottery. Good luck next time!");
        }
        else
        {
            
TotalWinners++; //so we got a one more winner
            //Award
        
}
    }
    if(
TotalWinners == 0SendClientMessageToAll(-1"nobody won"); 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)