SA-MP Forums Archive
SAMP Dialog Question - 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: SAMP Dialog Question (/showthread.php?tid=528847)



SAMP Dialog Question - Tayab - 30.07.2014

Hi, I had suppressed SAMP from my routine due to some personal stuff I was occupied with, I come back again. I need some help in reviving my skills.

I have a MySQL table 'characters' where all the information about the player is stored, including name. I want the user to be shown the dialog box which prints the usernames of all the characters of the master account that user logged in with and when the player clicks on a particular username from the dialog list, it'll load it's data. Here's my attempt.


pawn Код:
format(query,sizeof(query),"SELECT * FROM `characters` WHERE `master_username` = '%s'",pName(playerid));
mysql_query(query);
new characterCount = mysql_num_rows();
if(characterCount >= 1){
    mysql_fetch_field_row(data,"username");
    format(charnames,128,"%s",data);
    format(string,sizeof(string),"%s\n",charnames);
    ShowPlayerDialog(playerid,DIALOG_CHAR,"Characters",string,"Select","");
}
Will the above code list all the characters in the dialog box? If it does then in the OnDialogResponse how do I know which one is which. Like how do I know the username of the first list item is "Tayab_Soomro" and the second one is "Sergey_Brin" if that's the characters I have in my character table?

I hope to seek help!