Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.03 KB | None | 0 0
  1. stock showCountryDialog(const playerid, const page) {
  2.     new countryDialog[e_DIALOG_RESPONSE_INFO];
  3.     if (page == 1) {
  4.         task_await(
  5.             Database_QueryS(
  6.                 str_new(
  7.                     "SELECT `country_name` FROM `countries` WHERE ID <= '82'"
  8.                 )
  9.             )
  10.         );
  11.     } else if (page == 2) {
  12.         task_await(
  13.             Database_QueryS(
  14.                 str_new(
  15.                     "SELECT `country_name` FROM `countries` WHERE ID >= '83' AND ID <= '164'"
  16.                 )
  17.             )
  18.         );
  19.     } else if (page == 3) {
  20.         task_await(
  21.             Database_QueryS(
  22.                 str_new(
  23.                     "SELECT `country_name` FROM `countries` WHERE ID >= '165'"
  24.                 )
  25.             )
  26.         );
  27.     }
  28.     new String: cList = str_new_static("\n");
  29.     for(new r = 0; r < cache_num_rows(); r++) {
  30.         new countryName[40];
  31.         cache_get_value_name(r, "country_name", countryName);
  32.         str_append(cList, str_format("%s\n", countryName));
  33.     }
  34.     if (page == 1) {
  35.         str_append(cList, str_new(">>"));
  36.     } else if (page == 2) {
  37.         str_append(cList, str_new("<<\n>>"));
  38.     } if (page == 3) {
  39.         str_append(cList, str_new("<<"));
  40.     }
  41.     await_arr(countryDialog) ShowPlayerAsyncDialogStr(playerid, DIALOG_STYLE_LIST, str_new(""SERVER"Nalog > "WHITE"Odakle je Vaš karakter?"), cList, str_new(D_CONFIRM), str_new(D_CANCEL));
  42.     if (countryDialog[E_DIALOG_RESPONSE_Response]) {
  43.         if (countryDialog[E_DIALOG_RESPONSE_Listitem] == 82) {
  44.             showCountryDialog(playerid, (page == 1) ? (page + 1) : (page - 1));
  45.         }
  46.         else if (countryDialog[E_DIALOG_RESPONSE_Listitem] == 83) {
  47.             showCountryDialog(playerid, 3);
  48.         } else {
  49.             va_SendClientMessage(playerid, -1, "Listitem is %d", countryDialog[E_DIALOG_RESPONSE_Listitem]);
  50.             va_SendClientMessage(playerid, -1, "Page is %d", page);
  51.             task_await(
  52.                 Database_QueryS(
  53.                     str_format(
  54.                         "SELECT `country_name` FROM `countries` WHERE ID = '%d'",
  55.                         ((page - 1) * 82) + (countryDialog[E_DIALOG_RESPONSE_Listitem] + 1)
  56.                     )
  57.                 )
  58.             );
  59.             cache_get_value_name(0, "country_name", PlayerCountry[playerid]);
  60.             va_PlayerTextDrawSetString(playerid, PTD_Register[playerid][32], "%s", ret_strreplace(PlayerCountry[playerid], " ", "_"));
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement