Dialog problem
#5

pawn Код:
public ShowBankAccounts(playerid)
{
    new query[512],results[400],title[64];
    format(title,sizeof(title),"{1B8AE4}Your Bank Accounts");
    Num1[playerid] = 0;
    Num2[playerid] = 12;
    format(query,sizeof(query),"SELECT ID, Name, Balance FROM `bankaccounts` WHERE `Owner`='%s' ORDER BY `ID` DESC LIMIT %d, %d", PlayerName(playerid), Num1[playerid], Num2[playerid]);
    mysql_query(query);
    mysql_store_result();
    new tRows = mysql_num_rows();
    if(tRows == 0) { SCM(playerid, COLOR_RED, "You do not have any bank accounts!"); return 1; }
    new pID, pName[MAX_PLAYER_NAME], bBalance;

    format(results,sizeof(results),"Create Bank Account\nRemove Bank Account\n");

    while(mysql_fetch_row(query))
    {
        sscanf(query, "p<|>ds[24]d", pID, pName, bBalance);
        format(results,sizeof(results),"%s%d | %s | $%d\n", results,pID,pName,bBalance);
    }
    mysql_free_result();
    ShowPlayerDialog(playerid, mybankaccounts1, DIALOG_STYLE_LIST,title, results,"Select", "Back");
    return 1;
}
First create the 2 headers (Create bank account, Delete bank account) outside the loop.
Then after that, loop through the rows and add only the rows.

If you had 10 entries, you would have all of it 10 times.

Also, you had one "%s" too many in that format line.
Reply


Messages In This Thread
Dialog problem - by Jimmy0wns - 09.02.2014, 16:17
Re: Dialog problem - by Smileys - 09.02.2014, 18:03
Re: Dialog problem - by Jimmy0wns - 09.02.2014, 18:28
Re: Dialog problem - by Jimmy0wns - 10.02.2014, 18:26
Re: Dialog problem - by PowerPC603 - 10.02.2014, 18:38
Re: Dialog problem - by Jimmy0wns - 10.02.2014, 19:12

Forum Jump:


Users browsing this thread: 1 Guest(s)