Listitem. - 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: Listitem. (
/showthread.php?tid=403033)
Listitem. -
MagicznyKacper - 28.12.2012
Hi. At the outset I would like to apologize for my broken English. I want to my own inventory system, but I have problem which I can not deal with it. How to get paramters from DIALOG_STYLE_LIST? I want to make my own inventory system. Thanks.
Re: Listitem. -
Konstantinos - 28.12.2012
Parameters from listitem? Can you explain that a bit? What do you want to do with these parameters?
Re: Listitem. -
MagicznyKacper - 28.12.2012
That's my code:
Код:
stock ShowItems(playerid)
{
new query[128], row[128], data, string[2560], licznik, i;
format(query, sizeof(query), "SELECT MAX(uid) FROM mis_items");
mysql_query(query);
mysql_store_result();
mysql_fetch_row(row);
sscanf(row, "p<|>d", data);
mysql_free_result();
for(i = 0; i <= data; i++)
{
format(query, sizeof(query), "SELECT name, uid, type, value FROM mis_items WHERE uid='%i' AND owner='%s'", i, PlayerInfo[playerid][Nick]);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() == 1)
{
mysql_fetch_row(row);
sscanf(row, "p<|>s[64]ddd", PlayerItems[i][Name], PlayerItems[i][UID], PlayerItems[i][Type], PlayerItems[i][Value]);
format(string, sizeof(string), "%s\n%s [%i][%i]", string, PlayerItems[i][Name], PlayerItems[i][Type], PlayerItems[i][Value]);
DialogItemsID[playerid][i] = i;
i++;
}
licznik++;
mysql_free_result();
}
if(licznik > 0)
{
ShowPlayerDialog(playerid, D_ITEMS, DIALOG_STYLE_LIST, "Przedmioty", string, "Użyj", "Zamknij");
}
else
{
GameTextForPlayer(playerid, "Ta postac nie ma przedmiotow.", 2000, 1);
}
return 1;
}
GameTextForPlayer(playerid, "Ta postac nie ma przedmiotow.", 2000, 1); (GameTextForPlayer(playerid, "You don't have any items.", 2000, 1);
I have to get Items UID from this:
Код:
if(dialogid == D_ITEMS)
{
if(response == 1)
{
//I would like to see the name of the object that the player chose to dialog.
}
}
Re: Listitem. -
Luis- - 28.12.2012
Re: Listitem. -
MagicznyKacper - 28.12.2012
Quote:
Originally Posted by -Luis
|
Sequence each time may be different.
Re: Listitem. -
Mauzen - 28.12.2012
Buffer it somehow then, with SetPVarString or a global variable for example.
Re: Listitem. -
RedCrossER - 28.12.2012
Listitem == 0 { this your first item } so on
Re: Listitem. -
Luis- - 28.12.2012
Quote:
Originally Posted by MagicznyKacper
Sequence each time may be different.
|
I know that, and surley he knows that.