How do I convert this part to threaded mysql? - 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: How do I convert this part to threaded mysql? (
/showthread.php?tid=584857)
How do I convert this part to threaded mysql? -
Dokins - 08.08.2015
pawn Код:
forward GetRecord(playerid);
public GetRecord(playerid)
{
new r_msg[500], dialogstring[500];
new n = 0;
if(cache_num_rows() < 1)return SendClientMessage(playerid, COLOUR_GREY, "No records found.");
while(cache_get_row(0, 0, r_msg))
{
sscanf(r_msg, "p<|>e<iiiis[24]iiii>", PlayerArrests[n]);
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);
n++;
}
ShowPlayerDialog(playerid, DIALOG_RECORDS, DIALOG_STYLE_LIST, "Showing 10 Latest Records.", dialogstring, "Select", "Black");
return 1;
}
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 string[256];
format(string, sizeof(string), "SELECT * FROM `arecords` WHERE `PSQLID` = %d ORDER BY `id` DESC LIMIT 10", psql[playerid]);
mysql_tquery(dbHandle, string, "GetRecord", "i", playerid);
}
}
Title says all. I can't get the dialog to display.
Re: How do I convert this part to threaded mysql? -
Dokins - 10.08.2015
BUMP.
Re: How do I convert this part to threaded mysql? -
IstuntmanI - 10.08.2015
pawn Код:
forward GetRecord(playerid);
public GetRecord(playerid)
{
new r_msg[500], dialogstring[500], liRows = cache_get_row_count( );
if(liRows < 1)
return SendClientMessage(playerid, COLOUR_GREY, "No records found.");
for( new n = 0; n < liRows; n ++ )
{
cache_get_row(n, 0, r_msg);
sscanf(r_msg, "p<|>e<iiiis[24]iiii>", PlayerArrests[n]);
format(dialogstring, sizeof(dialogstring), "%s"#COL_WHITE"%s\n", dialogstring, PlayerArrests[n][ar_cr]);
}
strcpy(Pdialogstring[playerid], dialogstring, 200);
ShowPlayerDialog(playerid, DIALOG_RECORDS, DIALOG_STYLE_LIST, "Showing 10 Latest Records.", dialogstring, "Select", "Black");
return 1;
}
Re: How do I convert this part to threaded mysql? -
Dokins - 10.08.2015
Not working, won't display the results in the dialog.
Re: How do I convert this part to threaded mysql? -
Beckett - 10.08.2015
Your code is really confusing, can you show me how are you calling that callback through mysql_tquery function?