14.03.2014, 12:10
First we need how you want to use it, i will make make an example.
Let's say you want to use a loop to reach out an inventory system and you have the variable like this
If you want to make a loop to view items and on the final of the loop it stops and puts the "Next" line, it should be looking like this:
Let's say you want to use a loop to reach out an inventory system and you have the variable like this
pawn Код:
ItemInfo[MAX_PLAYERS][ItemName][MAX_ITEMS];
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_ITEMS) // first you check if they went to your dialog
{
new list[1024], limit = GetLastItem(playerid); // defining the list lenght and the limit of your loop
for(new i = 0; i <= limit; i++) // loop, you can start with 0 or 1, depends when your item id starts
{
new TextPart[32]; // defining the item name
if(limit) //checks if it is the end of the loop
{
strmid(TextPart, ItemInfo[playerid][ItemName][i], 0, 32, 32); // copying the name to a string
format(list, sizeof(list), "%s\n%d Item: '%s'\nNext", list, i, TextPart); // formats the last time with the "Next" line
}
else format(list, sizeof(list), "%s\n%d Item: '%s'", list, i, ItemInfo[playerid][ItemName][i]); // this format is doing all the work putting down the items each line
}
ShowPlayerDialog(playerid, DIALOG_ITEMS, DIALOG_STYLE_LIST, "View Item Menu", list, "View", "Back"); // it show the next dialog, you will have to edit it accordingly
}