31.01.2015, 17:28
(
Последний раз редактировалось rnw3089; 31.01.2015 в 18:36.
)
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(response)
{
new string[256];
format(string,sizeof(string),"{AFE7FF}Registering to [NMC] Destruction Derby (step 1):\n\n{C3C3C3}You have chosen to register the name %s. Choose a password to login with below. (Do not forget this password)\nAfterwards press 'continue'.",pName(playerid));
ShowPlayerDialog(playerid,DIALOG_REGISTER_1,DIALOG _STYLE_INPUT,"Register (step 1)",string,"Continue","Cancel");
}
}
case DIALOG_REGISTER_1:
{
if(response)
{
new string[256];
mysql_real_escape_string(inputtext,Player_Data[playerid][tmp_RegisterText1]);
if(strlen(Player_Data[playerid][tmp_RegisterText1]) <= 5)
{
SendClientMessage(playerid,RED,"Password too short. Try again.");
format(string,sizeof(string),"{AFE7FF}Registering to [NMC] Destruction Derby (step 1):\n\n{C3C3C3}You have chosen to register the name %s. Choose a password to login with below. (Do not forget this password)\nAfterwards press 'continue'.",pName(playerid));
ShowPlayerDialog(playerid,DIALOG_REGISTER_1,DIALOG _STYLE_INPUT,"Register (step 1)",string,"Continue","Cancel");
}
else
{
format(string,sizeof(string),"{AFE7FF}Registering to [NMC] Destruction Derby (step 2):\n\n{C3C3C3}You have chosen your password, if you're sure you typed it good enter your e-mail and press 'continue'.\nBe sure to type a valid e-mail !",pName(playerid));
ShowPlayerDialog(playerid,DIALOG_REGISTER_2,DIALOG _STYLE_INPUT,"Register (step 2)",string,"Continue","Cancel");
}
}
}
case DIALOG_REGISTER_2:
{
if(response)
{
mysql_real_escape_string(inputtext,Player_Data[playerid][tmp_RegisterText2]);
if(!IsValidEmail(Player_Data[playerid][tmp_RegisterText2]))
{
new string[256];
SendClientMessage(playerid,RED,"Invalid e-mail. Try again.");
format(string,sizeof(string),"{AFE7FF}Registering to [NMC] Destruction Derby (step 2):\n\n{C3C3C3}You have chosen your password, if you're sure you typed it good enter your e-mail and press 'continue'.\nBe sure to type a valid e-mail !",pName(playerid));
ShowPlayerDialog(playerid,DIALOG_REGISTER_2,DIALOG _STYLE_INPUT,"Register (step 2)",string,"Continue","Cancel");
}
else MySQL_Register(playerid);
}
}
case DIALOG_LOGIN:
{
if(response)
{
MySQL_Login(playerid, inputtext);
}
else
{
if(Server_Data[VoteActive])
{
ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Welcome back!\nPlease login by typing your password below.", "Login", "Cancel");
return 1;
}
new string[256];
SendClientMessage(playerid, WHITE, "This account is registered and therefor indentification is required.");
format(string, sizeof(string), "%s has been forced to disconnect. (Kicked: Failed to login)", pName(playerid));
SendClientMessageToAll(GREY, string);
Kick(playerid);
}
}