30.03.2014, 19:25
At the strcat part, I'm trying to copy over the string, so I can save it so they can go back to the string if the response is 0 on the next dialog, means they can browse through records.
I'm trying to get the dialog to open the saved string, based on a per-player array so it doesn't get over-written if someone else uses the dialog.
pawn Код:
else if(dialogid == DIALOG_SHOWPERSON)
{
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[200], string[128];
format(string, sizeof(string), "SELECT * FROM `arecords` WHERE `PSQLID` = %d ORDER BY `id` DESC LIMIT 10", psql[playerid]);
mysql_query(string);
mysql_store_result();
new r_msg[500];
new n = 0;
printf("psqlid: %d", psql[playerid]);
if(mysql_num_rows() < 1)return SendClientMessage(playerid, COLOUR_GREY, "No records found.");
while(mysql_fetch_row(r_msg))
{
sscanf(r_msg, "p<|>e<iiiis[24]iiii>", PlayerArrests[n]);
if(n == 0)
{
format(dialogstring, sizeof(dialogstring), ""#COL_WHITE"CRIME: "#COL_RED"%s", PlayerArrests[n][ar_cr]);
strcat(Pdialogstring[playerid], dialogstring, 200);
}
else
{
format(dialogstring, sizeof(dialogstring), "%s\n"#COL_WHITE"CRIME: "#COL_RED"%s", dialogstring, PlayerArrests[n][ar_cr]);
strcat(Pdialogstring[playerid], dialogstring, 200);
}
n++;
}
ShowPlayerDialog(playerid, DIALOG_RECORDS, DIALOG_STYLE_LIST, "Showing 10 Latest Records.", dialogstring, "Select", "Black");
}
}
I'm trying to get the dialog to open the saved string, based on a per-player array so it doesn't get over-written if someone else uses the dialog.
pawn Код:
else if(dialogid == DIALOG_RECORDS) //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".
{
ShowPlayerDialog(playerid, DIALOG_RECORDS, DIALOG_STYLE_LIST, "Showing 10 Latest Records.", Pdialogstring[playerid], "Select", "Black");
}