SA-MP Forums Archive
[HELP] Show MySQL data with DialogMSGBox - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Show MySQL data with DialogMSGBox (/showthread.php?tid=530722)



[HELP] Show MySQL data with DialogMSGBox - iryston - 08.08.2014

Hi, first, Thanks for being here reading and paying attention.

I have a CMD, "/Admins" to show a list with all admins in the table, my problem is in show it.

pawn Код:
public OnAdminsFound(playerid)
{
      new rows, fields, TotalRows;
      new nome[21], level, date[11], hide, rankx[13], temp[21], Str1[256], Str2[500];
      cache_get_data(rows, fields);
      while(TotalRows < rows)
      {
            cache_get_row(TotalRows, 1, temp), format(nome,21,temp);
            cache_get_row(TotalRows, 2, temp), level = strval(temp);
            cache_get_row(TotalRows, 4, temp), format(date,11,temp);
            cache_get_row(TotalRows, 12, temp), oculto = strval(temp);
            if (hide != 1)
            {
                if(level == 1)
                {
                    format(rankx,sizeof(rankx),"Moderator");
                }
                else if(level == 2)
                {
                    format(rankx,sizeof(rankx),"Administrator");
                }
                else if(level == 3)
                {
                    format(rankx,sizeof(rankx),"Owner");
                }
                format(Str1, sizeof(Str1), "{FFFFFF}Name: %s | Level:%i | Date: %s\n", nome,rankx,date);
                strcat(Str2, Str1);
                TotalRows++;
                ShowPlayerDialog(playerid, 1258, DIALOG_STYLE_MSGBOX, " * {FFFFFF}Administrators Online!", Str2, "Close", "");
            }

      }
      return 1;
}
So, if u can helpe me. Please!

Very thanks.


Re: [HELP] Show MySQL data with DialogMSGBox - Matess - 08.08.2014

For first
Код HTML:
Level:%i
should be
Код HTML:
Level:%s



Re: [HELP] Show MySQL data with DialogMSGBox - iryston - 08.08.2014

Oh shit, went unnoticed, thanks!

But the problem is, no show dialog =/ don't work..

When i use "/admins" nothing show


Re: [HELP] Show MySQL data with DialogMSGBox - Sawalha - 08.08.2014

Show the /admins cmd


Re: [HELP] Show MySQL data with DialogMSGBox - iryston - 08.08.2014

pawn Код:
CMD:admins(playerid, params[])
{
    mysql_function_query(Connect, "SELECT * FROM `admins` AND ORDER BY `Online` DESC", true, "OnAdminsFound", "i", playerid);
    return 1;
}
I have tried with SendClientMessage with another method and work.. More, when i try with Dialog don't work =/


Re: [HELP] Show MySQL data with DialogMSGBox - Matess - 08.08.2014

add
Код HTML:
print(str2);
under
Код HTML:
strcat(Str2, Str1);
and tell me if it is correct, maybe little string idk


Re: [HELP] Show MySQL data with DialogMSGBox - iryston - 08.08.2014

Very thanks for all!

I have found a problem, in CMD:
pawn Код:
mysql_function_query(Connect, "SELECT * FROM `admins` AND ORDER BY `Online` DESC", true, "OnAdminsFound", "i", playerid);
Correct, withou 'AND'
pawn Код:
mysql_function_query(Connect, "SELECT * FROM `admins` ORDER BY `Online` DESC", true, "OnAdminsFound", "i", playerid);