29.06.2018, 07:03
Quote:
|
You can use this code to do multiple pages:
Definition: Код:
#define MAX_LINE_PER_PAGE 30 Код:
static playerPage[MAX_PLAYERS] = {0, ...};
Код:
new vehList[][] = {
{"{FFFFFF}BMX"},
};
Код:
ShowPlayerVehicleDialog(playerid) {
static msg[30 * MAX_LINES_PER_PAGE], page = playerPage[playerid], i = page; // opimisation
for (; i < sizeof vehList; i++) {
if (i != 0 && (i - MAX_LINES_PER_PAGE) > MAX_LINES_PER_PAGE) break; // if player page is 0 then continue
strcat(msg, sizeof msg, "\n");
strcat(msg, sizeof msg, vehList[i]);
}
if (playerPage[playerid] >= sizeof vehList) {
SendClientMessage(playerid, -1, "Dialog closed.");
playerPage[playerid] = 0;
return false;
}
ShowPlayerDialog(playerid, DIALOG_VEHICLES, DIALOG_STYLE_LIST, "Vehicle List", msg, "Select", "Next");
return false; // this means the code successfully worked
}
Код:
CMD:vehiclelist(playerid) {
ShowPlayerVehicleDialog(playerid);
return 1;
}
![]() |
Each case corresponds to an item of the array?



