Could this be a infinite loop?
#1

PHP код:
    if (strcmp(tmp1"color"true) == 0)
    {
        new 
colorcolorstr[30];
        if (!
AdminCheck(playerid4)) return SendClientMessage(playeridERRORCOLOR"Usage: /gang [create|invite|kick|join|quit|setrank]");
        if (!
sscanf(tmp2"is[30]"idcolorstr))
        {
            if (
strlen(colorstr) != 6) return SendClientMessage(playeridERRORCOLOR"Invalid color code.");
            
strcat(tmp2"FF");
        }
        if (
sscanf(tmp2"ix"idcolor)) return SendClientMessage(playeridERRORCOLOR"Usage: /gang color [gangid] [colorcode]");
        
format(tmp1sizeof(tmp1), "SELECT * FROM `Gangs` WHERE `id` = %d"id);
        
result db_query(Databasetmp1);
        if (
db_num_rows(result) == 0)
        {
            
db_free_result(result);
               return 
SendClientMessage(playeridERRORCOLOR"Invalid gangid.");
        }
        
db_free_result(result);
        
format(tmp1sizeof(tmp1), "UPDATE `Gangs` SET `color` = %d WHERE `id` = %d"colorid);
        
db_query(Databasetmp1);
        
format(tmp1sizeof(tmp1), "SELECT * FROM `Gangmembers` WHERE `gangid` = %d"id);
        
result db_query(Databasetmp1);
        new 
rows db_num_rows(result);
        while (
rows)
        {
            
db_get_field_assoc(result"userid"tmp1sizeof(tmp1));
            new 
pid GetPlayerID(GetNameFromUserID(strval(tmp1)));
            if (
IsPlayerConnected(pid)) { SetPlayerColor(pidcolor); pcolor[pid] = color; }
            
db_next_row(result);
            
rows--;
        }
        
db_free_result(result);
        
SendMessageToGang(id"{8B72F2}Your gang color has changed.");
        return 
1;
    } 
I failed to understand the "0<rows"
Reply


Messages In This Thread
Could this be a infinite loop? - by iLearner - 20.12.2016, 05:58
Re: Could this be a infinite loop? - by Lordzy - 20.12.2016, 07:21
Re: Could this be a infinite loop? - by Vince - 20.12.2016, 09:23

Forum Jump:


Users browsing this thread: 1 Guest(s)