Dialog_list phonebook
#1

If you have saved any friend phonenumber, then is it possible to load them into DIALOG with mysql?
For example?

If i get DIALOG_STYLE_LIST, i can see saved numbers 371293, 993812, 338123, 333812 alligned.
i think its actualy possible, but how im able to sepparete them with \n?
Reply
#2

Just add \n after each item, so if you have the above it would be:

ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "Phone Numbers", "371293\n993812\n338123\n333812", "Select", "Cancel");

If that's what you were asking about. The actual loading them in from SQL would be a different story, have you already done that part?
Reply
#3

U dont get the point.
If im loading numbers from the database (there could be like 30 favorite numbers on each player) then how im gonna do it?
I would be able to do with limited system, like:

pawn Код:
new string[20];
format(string2, sizeof string, "%d\n%d\n%d\n%d\n%d", fNum1, fNum2, fNum3, fNum4, fNum5); //and so on...
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_LIST, "Header", string, "Select", "Return");
But is there also way for unlimited way?

For e.x:
pawn Код:
new string[20];
format(string2, sizeof string, "%d\n (but how im gonna separete others?", INSERT * FROM nfavorite); //and so on...
ShowPlayerDialog(playerid,DIALOG_STATS,DIALOG_STYLE_LIST, "Header", string, "Select", "Return");
Reply
#4

Ah create the string in a while loop of fetching the row's results, then use this function:

https://sampwiki.blast.hk/wiki/Strcat

That way you can add the \n to the end of each item.
Reply
#5

but how it actualy works? as i can see
strcat(string, "Hello,\n");
strcat(string, "my name is: "); (I need to put \n in here also, to send the new line?)
strcat(string, "[03]Garsino. "); ( and there also?)
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "strcat example", string, "Close", "");

I would need like
strcat(string, "Numbers\n");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "strcat example", string, "Close", "");
it it appears me in windows dialog like
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Header", num1\nNum2\num3 and so on...., "Close", "");
Not easy to explain how it should look.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)