How could i create that? -
Glossy42O - 28.10.2014
Hello, i wanna make that after someone registers/logins
It will show him that
PHP код:
ShowPlayerDialog(playerid, -1, DIALOG_STYLE_INPUT, ""COL_WHITE"Who invited you?",""COL_WHITE"If someone invited you to this server please put his name below\r\nif no one did just press ok","OK","");
But i want that after he puts that name it saves in folder called Invited or somethin
I am only stuck on
PHP код:
ShowPlayerDialog(playerid, -1, DIALOG_STYLE_INPUT, ""COL_WHITE"Who invited you?",""COL_WHITE"If someone invited you to this server please put his name below\r\nif no one did just press ok","OK","");
So if someone could find me a tutorial or EXPLAIN me how he did that
I know this is scripting help section not request but i really searched :\
Thanks.
Re: How could i create that? -
Stinged - 28.10.2014
pawn Код:
// Dialog id..
if (response)
{
if (isnull(inputtext)) return 1;
// If the player did not enter anything, it will just stop here without calling what's next.
new str[38];
GetPlayerName(playerid, str, sizeof (str));
format(str, sizeof (str), "invites/%s.txt", str);
// Formatting the string to invites/playername.txt
new File:file = fopen(str, io_write);
// Opening the file which is at "invites/playername.txt"
format(str, sizeof (str), "%s", inputtext);
// Formatting the string to what the player entered.
fwrite(file, str);
// Writing inside the file the name OF THE PLAYER THAT INVITED THEM.
fclose(file);
// Closing the file.
}
Re: How could i create that? -
Glossy42O - 28.10.2014
Btw where do i put the dialog ?
Re: How could i create that? -
Stinged - 28.10.2014
After they register.
Re: How could i create that? -
Glossy42O - 28.10.2014
Okay.
Re: How could i create that? -
Glossy42O - 28.10.2014
Where do i put ur code? in OnDialogResponse ?
Re: How could i create that? -
Rudy_ - 28.10.2014
Yes... on dialog_register
Re: How could i create that? -
Glossy42O - 28.10.2014
it doesn't show the reg dialog or invite
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if (response)
if (isnull(inputtext)) return 1;
new str[38];
GetPlayerName(playerid, str,sizeof(str));
format(str, sizeof(str), "Invites/%s.txt", str);
new File:file = fopen(str, io_write);
format(str, sizeof(str), "%s", inputtext);
fwrite(file, str);
fclose(file);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"{FF0000}>>|{00CC00}Please Register{FF0000}|<<",""COL_RED"You have entered an invalid password or you didn't put password at all.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File, "Score", GetPlayerScore(playerid));
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great ! Please Relog to save your stats.!","Ok","");
TogglePlayerControllable(playerid, 0);
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
SendClientMessage(playerid, 1, "{ff0000}[SERVER]{ffffff}: You have successfully logged in !");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"{FF0000}>>|{00CC00}Please Login{FF0000}|<<",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}
Re: How could i create that? -
Glossy42O - 29.10.2014
bump
Re: How could i create that? -
Threshold - 29.10.2014
Why are you using '-1' for the dialogid?