08.02.2019, 21:03
You kind of go like this I didn't test it or anything but take a look at how it works.
All you are doing is saving which page they are on then offsetting your array reference with the following formula.
(CurrPage * ItemsPerpage) + listitem
Код:
#define FURNITURE_PER_PAGE 25 if(listitem == 0) { new list[2048]; format(list, sizeof(list), ""C_ALB"#\t"C_ALB"Obiect\t"C_ALB"Pret\n"); for(new i = g_CurrFurnPage[playerid] * FURNITURE_PER_PAGE; i < sizeof(HouseFurnitures); ++i) { format(list, sizeof(list), "%s%d\t%s\t"C_MONE"$%s\n", list, i+1, HouseFurnitures[i][Name], convertNumber(HouseFurnitures[i][Price])); } format(list, sizeof(list), "%s\nNext Page\nLast Page"); ShowPlayerDialog(playerid, DIALOG_FURNITURE_BUY, DIALOG_STYLE_TABLIST_HEADERS, ""C_DIA"Meniu casa", list, "Buy", "Back"); } if(dialogid == DIALOG_FURNITURE_BUY) { if(!response || !inputtext[0]) return ShowHouseMenu(playerid); // Player clicked next page if(!strcmp(inputtext, "Next Page")) { // Check to make sure that there is more items to list if( (g_CurrFurnPage[playerid] * FURNITURE_PER_PAGE) < sizeof(list) ) g_CurrFurnPage[playerid]++; ShowHouseMenu(playerid); } // Player clicked last page else if(!strcmp(inputtext, "Last Page")) { // Can never be less than 0 no additional checks required! if(g_CurrFurnPage[playerid] > 0) g_CurrFurnPage[playerid]--; // Not sure if this is the right function but you need to show them the list again ShowHouseMenu(playerid); } // Player clicked some other list item else { } }
(CurrPage * ItemsPerpage) + listitem