• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Next and back button for dialogs.
#3
This is how far I got. (Note that the code below is from a different system, not warps, but spawns. Tho the code is?the same except for the variables.)



ID 0 isn't on the list anymore. The next page button acts as the teleport of ID 0 lol.. How do I proceed from here? I didn't add functionality to "next page" yet because I don't know how to fix the bug I just described and how to proceed.







[Image: cb75048eda4224d181b8dd315afd78ca.png]



Code:
? ? ? ?case E_SPAWN_DIALOG_LIST:

? ? ? ?{

? ? ? ? ? ?g_DialogPage[playerid] = 1;

? ? ? ? ? ?new title[128], spawnstr[2000], SpawnName[MAX_SPAWNS_NAME_SIZE], pages = GetPageCount(MAX_RESULTS, MAX_SPAWNS), count = ((MAX_RESULTS * g_DialogPage[playerid]) - MAX_RESULTS), bool:nextpage = false;

? ? ? ? ? ?format(spawnstr, sizeof spawnstr, INLINE[COLOR_SPOPT]"ID\t" INLINE[COLOR_SPOPT]"Location\n");

? ? ? ? ? ?for(new i = count; i < MAX_SPAWNS; i)

? ? ? ? ? ?{

? ? ? ? ? ? ? ?if(!g_SpawnsInfo[i][E_SPAWN_EXISTS])

? ? ? ? ? ? ? ? ? ?continue;

? ? ? ? ? ? ? ?else

? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ?count ;

? ? ? ? ? ? ? ? ? ?if(count <= MAX_RESULTS * g_DialogPage[playerid])

? ? ? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ? ? ?GetPickup3DLocation(g_SpawnsInfo[count][E_SPAWN_POS][0], g_SpawnsInfo[count][E_SPAWN_POS][1], g_SpawnsInfo[count][E_SPAWN_POS][2], SpawnName, MAX_SPAWNS_NAME_SIZE);

? ? ? ? ? ? ? ? ? ? ? ?format(spawnstr, sizeof(spawnstr), "%s" INLINE[COLOR_OPTION] "#%d\t" INLINE[COLOR_OPTION] "%s\t\n", spawnstr, count, SpawnName);

? ? ? ? ? ? ? ? ? ?}

? ? ? ? ? ? ? ? ? ?if(count > MAX_RESULTS * g_DialogPage[playerid])

? ? ? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ? ? ?nextpage = true;

? ? ? ? ? ? ? ? ? ? ? ?break;

? ? ? ? ? ? ? ? ? ?}

? ? ? ? ? ? ? ?}

? ? ? ? ? ?}



? ? ? ? ? ?if(nextpage == true)

? ? ? ? ? ?{

? ? ? ? ? ? ? ?if(g_DialogPage[playerid] == 1)

? ? ? ? ? ? ? ? ? ?format(spawnstr, sizeof(spawnstr), "%s" INLINE[COLOR_SPOPT] "Next page", spawnstr);

? ? ? ? ? ? ? ?else if(g_DialogPage[playerid] == pages)

? ? ? ? ? ? ? ? ? ?format(spawnstr, sizeof(spawnstr), "%s" INLINE[COLOR_SPOPT] "Previous page", spawnstr);

? ? ? ? ? ? ? ?else if(g_DialogPage[playerid] > 1)

? ? ? ? ? ? ? ? ? ?format(spawnstr, sizeof(spawnstr), "%s" INLINE[COLOR_SPOPT] "Next page\nPrevious page", spawnstr);

? ? ? ? ? ?}



? ? ? ? ? ?format(title, sizeof title, INLINE[COLOR_HEADER]"Spawnpoints (Page %d of %d)", g_DialogPage[playerid], pages);



? ? ? ? ? ?inline DialogResponse_2(_playerid, dialogid, response, listitem, inputtext[])

? ? ? ? ? ?{

? ? ? ? ? ? ? ?#pragma unused dialogid, listitem

? ? ? ? ? ? ? ?if(!response)

? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ?g_DialogPage[playerid] = 0;

? ? ? ? ? ? ? ? ? ?SPAWNS_TeleportList(_playerid, E_SPAWN_DIALOG_MAIN);

? ? ? ? ? ? ? ? ? ?return 1;

? ? ? ? ? ? ? ?}

? ? ? ? ? ? ? ?if(response)

? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ?if(g_AccountInfo[playerid][E_ACCOUNT_ADMIN_LEVEL] >= ADMIN_LEAD)

? ? ? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ? ? ?new str[256], spawn_id;



? ? ? ? ? ? ? ? ? ? ? ?sscanf(inputtext[1],"d",spawn_id);



? ? ? ? ? ? ? ? ? ? ? ?DelayedTeleport(playerid, g_TeleportDelay, g_SpawnsInfo[spawn_id][E_SPAWN_POS][0], g_SpawnsInfo[spawn_id][E_SPAWN_POS][1], g_SpawnsInfo[spawn_id][E_SPAWN_POS][2]  0.5, g_SpawnsInfo[spawn_id][E_SPAWN_POS][3], 0, 0);



? ? ? ? ? ? ? ? ? ? ? ?GetPickup3DLocation(g_SpawnsInfo[spawn_id][E_SPAWN_POS][0], g_SpawnsInfo[spawn_id][E_SPAWN_POS][1], g_SpawnsInfo[spawn_id][E_SPAWN_POS][2], SpawnName, MAX_SPAWNS_NAME_SIZE);

? ? ? ? ? ? ? ? ? ? ? ?format(str, sizeof(str), "%s %s(%d) has warped to a spawnpoint in %s(%d).", ReturnStaffLevel(playerid), ReturnICName(playerid), playerid, SpawnName, spawn_id);

? ? ? ? ? ? ? ? ? ? ? ?ABroadCast(COLOR[COLOR_SADMIN], str, 1);



? ? ? ? ? ? ? ? ? ?}

? ? ? ? ? ? ? ? ? ?else return SendClientMessage(playerid,COLOR[COLOR_ERROR],AMSG_NO_ACCESS_TO_USE);

? ? ? ? ? ? ? ?}

? ? ? ? ? ?}



? ? ? ? ? ?Dialog_ShowCallback(playerid, using inline DialogResponse_2, DIALOG_STYLE_TABLIST_HEADERS, title, spawnstr, "Select", "Return");

? ? ? ?}
  Reply


Messages In This Thread
Next and back button for dialogs. - by Stefhan - 2020-03-24, 05:51 PM
RE: Next and back button for dialogs. - by Stefhan - 2020-03-25, 07:55 PM

Forum Jump: