Threaded MYSQL query, won't display in dialog, assistance would be appreciated.
#1

pawn Код:
forward GetRecord(playerid);
public GetRecord(playerid)
{
    new r_msg[256], dialogstring[256], Rows = cache_get_row_count( );

    if(Rows < 1)return SendClientMessage(playerid, COLOUR_GREY, "No records found.");

    for(new n = 0; n < Rows; n++)
    {
        cache_get_row(0, 0, r_msg);
        sscanf(r_msg, "p<|>e<iiiis[24]iiii>", PlayerArrests[n]);
        cache_get_field_content(0, "Crime", PlayerArrests[n][ar_cr]);
        if(n == 0)
        {
            format(dialogstring, sizeof(dialogstring), ""#COL_WHITE"%s", PlayerArrests[n][ar_cr]);
        }
        else
        {
            format(dialogstring, sizeof(dialogstring), "%s\n"#COL_WHITE"%s", dialogstring, PlayerArrests[n][ar_cr]);
        }
    }

    strcpy(Pdialogstring[playerid], dialogstring, 200);
    ShowPlayerDialog(playerid, DIALOG_RECORDS, DIALOG_STYLE_LIST, "Showing 10 Latest Records.", dialogstring, "Select", "Back");
    return 1;
}
Title says all. It won't display in the dialog when I search a player that has records.
Reply
#2

BUMP
Reply
#3

BUMP.
Reply
#4

You've to mention the size in cache_get_field_content when you're dealing with multi-dimensional arrays.
Reply
#5

Size of the string?
Reply
#6

cache_get_field_content(0, "Crime", PlayerArrests[n][ar_cr]); - Size of ar_cr?
Reply
#7

Cache_get_row, shouldn't the 0 be n?
cache_get_row(n, 0, r_msg);
Cache_get_field_content should also be n instead of 0.
Reply
#8

I'm not sure.
Reply
#9

cache_get_field_content(0, "Username", PlayerI[playerid][Name], mysql, MAX_PLAYER_NAME);
Here is an example of how you should use mysql get field content when having strings in enums ^^^
last one (MAX_PLAYER_NAME) is the size, you should get ar_cr's size and put it there.
Reply
#10

Thank you!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)