14.12.2014, 12:43
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:
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;
}