26.03.2014, 22:51
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.
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[][]?
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];
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");
}
}