Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock showCountryDialog(const playerid, const page) {
- new countryDialog[e_DIALOG_RESPONSE_INFO];
- if (page == 1) {
- task_await(
- Database_QueryS(
- str_new(
- "SELECT `country_name` FROM `countries` WHERE ID <= '82'"
- )
- )
- );
- } else if (page == 2) {
- task_await(
- Database_QueryS(
- str_new(
- "SELECT `country_name` FROM `countries` WHERE ID >= '83' AND ID <= '164'"
- )
- )
- );
- } else if (page == 3) {
- task_await(
- Database_QueryS(
- str_new(
- "SELECT `country_name` FROM `countries` WHERE ID >= '165'"
- )
- )
- );
- }
- new String: cList = str_new_static("\n");
- for(new r = 0; r < cache_num_rows(); r++) {
- new countryName[40];
- cache_get_value_name(r, "country_name", countryName);
- str_append(cList, str_format("%s\n", countryName));
- }
- if (page == 1) {
- str_append(cList, str_new(">>"));
- } else if (page == 2) {
- str_append(cList, str_new("<<\n>>"));
- } if (page == 3) {
- str_append(cList, str_new("<<"));
- }
- 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));
- if (countryDialog[E_DIALOG_RESPONSE_Response]) {
- if (countryDialog[E_DIALOG_RESPONSE_Listitem] == 82) {
- showCountryDialog(playerid, (page == 1) ? (page + 1) : (page - 1));
- }
- else if (countryDialog[E_DIALOG_RESPONSE_Listitem] == 83) {
- showCountryDialog(playerid, 3);
- } else {
- va_SendClientMessage(playerid, -1, "Listitem is %d", countryDialog[E_DIALOG_RESPONSE_Listitem]);
- va_SendClientMessage(playerid, -1, "Page is %d", page);
- task_await(
- Database_QueryS(
- str_format(
- "SELECT `country_name` FROM `countries` WHERE ID = '%d'",
- ((page - 1) * 82) + (countryDialog[E_DIALOG_RESPONSE_Listitem] + 1)
- )
- )
- );
- cache_get_value_name(0, "country_name", PlayerCountry[playerid]);
- va_PlayerTextDrawSetString(playerid, PTD_Register[playerid][32], "%s", ret_strreplace(PlayerCountry[playerid], " ", "_"));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement