ShowPlayerDialog
#1

Hello i wnana ask u guys today if it is possible to add player name strings (%s) on dialogs.

If not, how do people do it?


Thanks
Reply
#2

pawn Код:
new my_dialog_string[60], name[24]; GetPlayerName(playerid, name, 24);
format(my_dialog_string, 60, "Hello %s!", name);
ShowPlayerDialog(playerid, DIALOG_WHATEVER_ID, DIALOG_STLYE_MESSAGE, my_dialog_string, ... );
Reply
#3

pawn Код:
new string[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s", name);
ShowPlayerDialog(playerid, [yourdialogid], DIALOG_STYLE_MSGBOX, "Name",string,"Done","Cancel");
as simple as that

EDIT: too late ^^
Reply
#4

Sure you can.
pawn Код:
new string[115],pname[24];//The dialog string and the player name string.
GetPlayerName(playerid,pname,sizeof(pname));//Getting the playername
format(string,sizeof(string),"Your name is %s",pname);//This will get the player name and the out put coulf be what ever you want, ClientMessage,GameText,Textdraw ect..
ShowPlayerDialog(playerid, 450, DIALOG_STYLE_MSGBOX, ".::Your dialog title::." ,string, "Close" , "" );//This will be the output, it will be sent as a Dialog.
P.S:The code above is just an example, it might work, or not
Reply
#5

it is possible

pawn Код:
new string[128], pName[24];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof string, "Welcome %s to i'm trap server", pName);
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Test Dialog", string, "Noob", "NVM");
Reply
#6

PHP код:
new str[128], str2[128], name[MAX_PLAYER_NAME];
GetPlayerName(playeridnameMAX_PLAYER_NAME);
format(strsizeof(str), "my name is: %s"name);
format(str2sizeof(str2), "my id is: %d"playerid);
ShowPlayerDialog(playeridDIALOG_IDDIALOG_STYLE_INPUTstrstr2"Okay""Close"); 
That's just an example, learn how to use format
Reply
#7

Hello Another exemple:

pawn Код:
#define PTD 123

new PT[70], ptname[24];
GetPlayerName(playerid, ptname, sizeof(ptname));
format(PT,sizeof(PT),"Your name is %s",ptname);
ShowPlayerDialog(playerid, PTD, DIALOG_STYLE_MSGBOX, ".... Your Name ...." , PT, "OK" , "" );

PT
Reply
#8

Thanks i just didnt knew that much about dialogs
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)