Dialog doesn't work -
bartje01 - 31.10.2011
Hello everyone. I'm back into scripting, it've been a long time again and I'm already stuck at the registering script.
My register and login dialog work fine but my email dialog doesn't have any effect. Even the message Works isn't working.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\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,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
ShowPlayerDialog(playerid,DIALOG_EMAIL, DIALOG_STYLE_INPUT,""COL_WHITE"Email",""COL_WHITE"Please fill in your email to activate your account.\nYour email will be privat and we will not use it.","Activate","Quit");
}
}
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]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_WHITE"You have {00FF22}successfully{FFFFFF} logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
case DIALOG_EMAIL:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, ""COL_WHITE"Email",""COL_RED"You have entered an invalid email.\n"COL_WHITE"Please fill in your email to activate your account.","Activate","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_WriteInt(File,"Email",inputtext[60]);
INI_Close(File);
SendClientMessage(playerid,0xFFFFFFAA,"Works");
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_WHITE"You are {00FF22}succesfully{FFFFFF} registered to our database","Ok","");
}
}
}
return 1;
}
So the problem is het my DIALOG_EMAIL has no effect. What could it be?
Thanks.
Re: Dialog doesn't work -
=WoR=G4M3Ov3r - 31.10.2011
Does your email dialog pop up at first ?
Re: Dialog doesn't work -
bartje01 - 31.10.2011
My email Dialog pops up after I registered
Re: Dialog doesn't work -
KoczkaHUN - 31.10.2011
What is your UserPath(playerid) ?
Re: Dialog doesn't work -
Wesley221 - 31.10.2011
If this is a filterscript, OnDialogResponse should return 0.
pawn Код:
public OnDialogResponse(....)
{
return 0; // 0 for filterscripts, 1 for gamemodes
}
Re: Dialog doesn't work -
bartje01 - 31.10.2011
It's not a filterscript and the other two dialogs work fine.
My path:
#define PATH "/Users/%s.ini"
Re: Dialog doesn't work -
Wesley221 - 31.10.2011
Use 'print' to check if the dialog is even getting a response
Re: Dialog doesn't work -
bartje01 - 31.10.2011
Quote:
Originally Posted by Wesley221
Use 'print' to check if the dialog is even getting a response
|
Nope, it's not respondig 0_0
Re: Dialog doesn't work -
Wesley221 - 31.10.2011
How did you define 'DIALOG_EMAIL'?
Also, it does show the dialog right?
Re: Dialog doesn't work -
bartje01 - 31.10.2011
Defined like this:
pawn Код:
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define DIALOG_EMAIL 5
And yes, it does show the dialog.