What do I define this as instead of MAX_PLAYERS? (MySQL)
#1

Basically, the 'id' variable is global, it's retrieved from another mysql query in a different dialog-...

The issue I'm having is that:

I want the dialog to display the results for an offline player, but I'm not used to using enums, but I learned in this one.

pawn Код:
enum Par
{
    ar_id,
    ar_ps,
    ar_os,
    ar_ar,
    ar_cr[24],
    ar_wl,
    ar_ti,
    ar_wi
}
new PlayerArrests[MAX_PLAYERS][Par];
The problem is, PlayerArrest is a MAX_PLAYERS, but what do I do to make a new parameter for SQLID, as in if I were to use it there, It would set it to the player logged in as the one in MAX_PLAYERS.

Basically what can I put instead of MAX_PLAYERS in PlayerArrest[][]?

pawn Код:
else if(dialogid == DIALOG_SHOWPERSON)   //if the player responsed to the dialog (ID = 0, as we've set it as such - you'll use your definition) then the script continues here
            {
                if(response == 0)   //response 0 is always the SECOND BUTTON! (in our case this was "Close".
                {
                    return 1;
                }
                else //If the player did not press the close button, but the "Select" button, the script reads the following.
                {
                    new dialogstring[128],string[128];

                    format(string, sizeof(string), "SELECT * FROM `arecords` WHERE `PSQLID` = %d ORDER BY `id` DESC LIMIT 10", id);
                    mysql_query(string);
                    mysql_store_result();
                    new r_msg[500];
                    while(mysql_fetch_row(r_msg))
                    {
                        sscanf(r_msg, "p<|>e<iiiis[24]iii>", PlayerArrests[id]);
                        if(mysql_num_rows() == 0)
                        {
                            format(dialogstring, sizeof(dialogstring), "%s", PlayerArrests[id][ar_cr]);
                        }
                        if(mysql_num_rows() > 0)
                        {
                            format(dialogstring, sizeof(dialogstring), "%s\n%s", dialogstring, PlayerArrests[id][ar_cr]);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOUR_GREY, "No records found.");
                        }
                    }
                    ShowPlayerDialog(playerid, DIALOG_RECORDS, DIALOG_STYLE_LIST, "Arrest Info", dialogstring, "Select", "Close");
                }
            }
Reply
#2

So if I understand correctly, you are not using a database but want to retrieve enum info for a player not even logged in? Sorry if I've mis-understood you. If this is the case you'll need a loading/saving system for the enum.
Reply
#3

That's correct.

How would I do that?
Reply
#4

Still unresolved.
Reply
#5

So you do NOT have a saving/loading system for the enum yet?
Reply
#6

I don't understand what you mean for the enum system? It stores the data in a MySQL table but not in a player one, seperate.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)