Help with Getplayername in Dialog on logging
#1

Код:
if(fexist(UserPath(playerid)))
	{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  		ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login",""COL_WHITE"The account is already registered,please type your password. \n "COL_ORANGE"Username:"COL_WHITE" string \n "COL_ORANGE"Password :","Login","Quit");
	}
	else
	{
 		ShowPlayerDialog(playerid,DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_GREEN"Registering...",""COL_ORANGE"Type your password below to register a new account :((How to get players name and put it here","Register","Quit");
	}
I'm trying to show the players name after username :
How do I use Getplayername to show the players name in Dialog
Код:
       {
 		ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login",""COL_WHITE"The account is already registered,please type your password. \n "COL_ORANGE"Username:((How to show the players name here who is logging in ))"COL_WHITE" string \n "COL_ORANGE"Password :","Login","Quit");

	}
Part of the dialog text

Код:
\n "COL_ORANGE"Username:((How to show the players name here who is logging in ))
Reply
#2

test
format(Query, sizeof(Query), "{FFFFFF}Type your password below to register a new account %s((How to get players name and put it here", name, playerid);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FFFFFF}Registering...", Query, "Register", "Quit");
Reply
#3

I need three lines in one dialog including the string
Can there be multiple strings like I want something like this

Caption : Login

Message : The account is already registered

Username : [[I want the players name here through getplayersname somehow]
password :

So these are 3 separate lines in one dialog.How do I do this while also getting players name
Reply
#4

To create new lines, use \n wherever you want to end the line and start a new one. Using \n twice will create two lines, etc..

To get the name, https://sampwiki.blast.hk/wiki/GetPlayerName

I think thats what you want.
Reply
#5

Quote:

new username[MAX_PLAYER_NAME], usernamemessage[23 + MAX_PLAYER_NAME];
GetPlayerName(playerid, username, sizeof(username));
format(usernamemessage, sizeof(usernamemessage), ""COL_WHITE"The account is already registered,type in your password \n "COL_ORANGE"Username:"COL_WHITE"%s \n "COL_ORANGE"Password:", usernamemessage);


if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login","username message,"Login","Quit");
}

This is what I want if you get the idea I'm about to try this

Edit : Did not work login dialog only showed this in end "The account is already registered,type"
Reply
#6

Код HTML:
    new string[256];
	format(string, sizeof(string), "This account is already registered, please type your password.\n\nUsername: %s\nPassword:", PlayerName(playerid));
 	ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login", string, "Login","Quit");
Reply
#7

Quote:
Originally Posted by MrAjusshi
Посмотреть сообщение
Код HTML:
    new string[1024];
    format(string, sizeof(string), "This account is already registered, please type your password.\n\nUsername: %s\nPassword:", PlayerName(playerid));
    ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login", string, "Login","Quit");
Код:
new string[1024];
That does not need to be that big, you can decrease it. Something around 144 (I'm guessing should be fine, including the playername which is 24 characters long).
Reply
#8

Ye I know.. It because I copied from my script which needed to be 1024 otherwise it's didn't work.

Edited.
Reply
#9

Quote:

new username [24] , new string [1024];
GetPlayerName(playerid, username, sizeof(username));
format(string, sizeof(string), "This account is already registered, please type your password.\n\nUsername: %s\nPassword:",username);
ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login", string, "Login","Quit");

What am I doing wrong here

Quote:

E:\Pawno\pawno\CODTOW.pwn(177) : error 001: expected token: "-identifier-", but found "new"
E:\Pawno\pawno\CODTOW.pwn(17- : error 017: undefined symbol "string"
E:\Pawno\pawno\CODTOW.pwn(17- : error 017: undefined symbol "string"
E:\Pawno\pawno\CODTOW.pwn(17- : error 029: invalid expression, assumed zero
E:\Pawno\pawno\CODTOW.pwn(17- : fatal error 107: too many error messages on one line

Reply
#10

Код:
if(fexist(UserPath(playerid)))
{
    new playername[MAX_PLAYER_NAME], dialog_string[120 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(dialog_string, sizeof(dialog_string), ""COL_WHITE"The account is already registered,type in your password \n "COL_ORANGE"Username:"COL_WHITE"%s \n "COL_ORANGE"Password:", dialog_string);

    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_GREEN"Login", dialog_string, "Login", "Quit");
}
Try that.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)