MySQL dialog problem - 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: MySQL dialog problem (
/showthread.php?tid=583619)
MySQL dialog problem -
Zens - 29.07.2015
When I click the 1st dialog it opens the last dialog.. Here's the code:
Stock:
Код:
stock ViewIBay(playerid)
{
static
string[128];
format(string, sizeof(string), "SELECT * FROM `ibay` ORDER BY `ibHeadline` DESC");
mysql_function_query(g_iHandle, string, true, "OnViewIBay", "d", playerid);
return 1;
}
Onview
Код:
forward OnViewIBay(extraid, name[]);
public OnViewIBay(extraid, name[])
{
static
rows,
fields;
cache_get_data(rows, fields, g_iHandle);
if (!rows)
return SendErrorMessage(extraid, "There is currently no active advertisements on IBay, check back later!");
static
string[1024],
desc[128];
string[0] = 0;
for (new i = 0; i < rows; i ++) {
cache_get_field_content(i, "ibHeadline", desc, g_iHandle);
//format(string, sizeof(string), "%s{FFFFFF}%s ({FFBF00}%i{FFFFFF})\n", string, desc, i);
format(string, sizeof(string), "%s|Advertisement: %s | Market {FFBF00}%i{FFFFFF}\n", string, desc, i);
}
format(desc, sizeof(desc), "Succesfully connected to IBay", name);
Dialog_Show(extraid, IBays, DIALOG_STYLE_LIST, desc, string, "View", "Close");
return 1;
}
Код:
Dialog:IBays(playerid, response, listitem, inputtext[]) {
if (response)
{
new string[500], szString[100];
if(IBayData[listitem][ibExists] >= 1)
{
if(!IBayData[listitem][ibOwner])
{
BillboardCheckout[playerid] = listitem;
format(szString, sizeof(szString), "{FFFFFF}%s -{FF8000} %i", IBayData[listitem][ibHeadline], listitem);
format(string, sizeof(string), "{FF8000}%s{FFFFFF}\n\nIBay is not affiliated with any of the sales, deal and sell items at your own risk. \nTake cautions from buying/selling illegal items, as this site is being monitored daily by employees.", IBayData[listitem][ibMessage]);
Dialog_Show(playerid, IBayBack, DIALOG_STYLE_MSGBOX, szString, string, "Back", "Exit");
return 1;
}
}
}
return 1;
}
Re: MySQL dialog problem -
Midzi - 29.07.2015
Код:
format(string, sizeof(string), "SELECT * FROM `ibay` ORDER BY `ibHeadline` DESC");
change to:
Код:
format(string, sizeof(string), "SELECT * FROM `ibay` ORDER BY `ibHeadline` ASC");
I have a question, why you don't use default dialogs by SA-MP? :P