Generating Different Information on Each Line of the Dialog
#1

I am trying to generate different information of different locations and IDs in the dialog.
Without any success.

I bassicly want it to check how many rows has been found in the database and create an equivalent amount of 'list-items' inside that dialog.

I have tried it with a while loop and a for loop but my code just simply won't work correctly, it'll only post the last row that has been found in the database.
The code will bassicly run through everything in the database, select the last row, and put one 'list-item' inside the dialog instead of doing it for every row.

Code:

pawn Код:
YCMD:viewdealerships(playerid, params[], help) {

    if(!IsPlayerAdmin(playerid)) return 0;
    else {
        mysql_tquery(dbHandle, "SELECT * FROM `dealerships`", "viewDEALERSHIPS", "d", playerid);
    }
    return 1;
}

forward viewDEALERSHIPS(playerid);
public viewDEALERSHIPS(playerid) {
    new string[1000];
    new i = 0;
    new rows = cache_get_row_count(dbHandle);
    while(i < rows) {
        format(string, sizeof(string), "[ID:%d] [PosX:%f] [PosY:%f] [PosZ:%f]\n", rows, DS[i][DsLocX], DS[i][DsLocY], DS[i][DsLocZ]);
        i++;
    }
    ShowPlayerDialog(playerid, DIALOG_VIEW_DEALERSHIPS, DIALOG_STYLE_LIST, "All of DEALERSHIPss INFORMATION", string, "Close", "");
    return 1;
}
Reply


Messages In This Thread
Generating Different Information on Each Line of the Dialog - by Ox1gEN - 14.12.2014, 12:43
Re: Generating Different Information on Each Line of the Dialog - by Lordzy - 14.12.2014, 12:52
Re: Generating Different Information on Each Line of the Dialog - by Ox1gEN - 14.12.2014, 12:57
Re: Generating Different Information on Each Line of the Dialog - by Vince - 14.12.2014, 13:46
Re: Generating Different Information on Each Line of the Dialog - by Ox1gEN - 14.12.2014, 16:00

Forum Jump:


Users browsing this thread: 1 Guest(s)