SA-MP Forums Archive
Retrieve dialog listitem name - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Retrieve dialog listitem name (/showthread.php?tid=241745)



Retrieve dialog listitem name - actiwe - 18.03.2011

Is it possible and if is then how ?


Re: Retrieve dialog listitem name - Mauzen - 18.03.2011

It is, but not native.
Create a global string for a specific dialog and put the listitem text in it when showing the dialog.
In OnPlayerDialogResponse use a separatorfunction, something to get a single line (element) of the string by its index and you got it. There might be such a function somewhere here in the forum, else it shouldnt be hard to make one yourself.


Re: Retrieve dialog listitem name - Kyosaur - 18.03.2011

Well when you get a response, it gives you the ID of the listitem. If you used an array to build the dialog, use it as an index. If you used static text, make a switch statement based on the id (since its static text, you have to make this part static as well).


If you need me to go more indepth, PM me.


Re: Retrieve dialog listitem name - actiwe - 18.03.2011

Solved it by creating:
pawn Code:
new CharName[MAX_PLAYERS][CHARACTERS][32];
When fetching data from MySQL(afterwards putted to dialog):
pawn Code:
CharName[playerid][i] = Field;
i++;
So that i is equal to listitem.
And for data display(it is called under dialog):
pawn Code:
CharName[playerid][listitem];