OnPlayerRequestClass issue -
Darth1993 - 17.03.2012
Hello, I made an advanced registration system for my gamemode, where you need to enter password, repeat it, enter security question and etc, but I have a small issue:
When I enter password in 1st dialog, OnPlayerRequestClass callback got activated and I see classes and textdraws which I made.
So, how to avoid this? I want to see OnPlayerRequestClass only when I enter data in the last dialog (Secret answer).
Re: OnPlayerRequestClass issue -
ReneG - 17.03.2012
Post your OnDialogResponse for the password dialog.
Re: OnPlayerRequestClass issue -
Darth1993 - 17.03.2012
Код:
new query[400];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(query, sizeof(query), "SELECT * FROM `players` WHERE name = '%s' LIMIT 1", name);
mysql_query(query);
mysql_store_result();
new rows = mysql_num_rows();
if(!rows) ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registration",""COL_WHITE"Enter password to register in our server.","Next","Quit");
if(rows == 1)
{
ResetPlayerCash(playerid);
new string[1024];
if(mysql_fetch_row_format(string,"|"))
{
mysql_fetch_field_row(PlayerInfo[playerid][pPass], "pass");
mysql_fetch_field_row(string, "uzbanintas"); PlayerInfo[playerid][pUzbanintas] = strval(string);
mysql_fetch_field_row(PlayerInfo[playerid][pPriezastis], "priezastis");
mysql_fetch_field_row(PlayerInfo[playerid][pKasBan], "kas_ban");
mysql_fetch_field_row(string, "ban_laikas"); PlayerInfo[playerid][pBanLaikas] = strval(string);
mysql_fetch_field_row(PlayerInfo[playerid][pSlaptKlaus], "slapt_klaus");
mysql_fetch_field_row(PlayerInfo[playerid][pSlaptAts], "slapt_ats");
mysql_fetch_field_row(string, "pinigai"); PlayerInfo[playerid][pPinigai] = strval(string);
mysql_fetch_field_row(string, "ar_adminas"); PlayerInfo[playerid][pAdminas] = strval(string);
mysql_fetch_field_row(string, "ar_vip"); PlayerInfo[playerid][pVipas] = strval(string);
mysql_fetch_field_row(string, "pos_x"); PlayerInfo[playerid][pPosX] = floatstr(string);
mysql_fetch_field_row(string, "pos_y"); PlayerInfo[playerid][pPosY] = floatstr(string);
mysql_fetch_field_row(string, "pos_z"); PlayerInfo[playerid][pPosZ] = floatstr(string);
mysql_fetch_field_row(string, "active_class"); PlayerInfo[playerid][pActiveClass] = strval(string);
mysql_fetch_field_row(string, "team"); PlayerInfo[playerid][pTeam] = strval(string);
if (PlayerInfo[playerid][pUzbanintas] > 0)
{
new textas[225];
new textas1[225];
format(textas, sizeof(textas), "Jus uюblokavo: {FFFFFF}%s", PlayerInfo[playerid][pKasBan]);
format(textas1, sizeof(textas1), "Prieюastis: {FFFFFF}%s", PlayerInfo[playerid][pPriezastis]);
SendClientMessage(playerid, COL_SYSTEM, "Jыs esate uюblokuotas!");
SendClientMessage(playerid, COL_SYSTEM, textas);
SendClientMessage(playerid, COL_SYSTEM, textas1);
SendClientMessage(playerid, COL_SYSTEM, "Atblokuoti savo vartotojo vardа galite mыsш tinklapyje.");
Kick(playerid);
}
new nm[225];
format(nm,sizeof(nm),""COL_WHITE"Welcome back, "COL_GREEN"%s.\n{65CFBD}Please enter your password:",name);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Login", nm, "Enter", "Quit");
}
}
mysql_free_result();
return 1;
}
Код:
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_PASSWORD, ""COL_WHITE"Registration",""COL_RED"You entered an incorrect password.\n"COL_WHITE"In order to be registered in our server, please enter an password for your account.","Next","Quit");
new inputt[225];
format(inputt,sizeof(inputt), inputtext);
passwd[playerid] = inputt;
ShowPlayerDialog(playerid, DIALOG_REGISTER_2, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registration",""COL_WHITE"Please repeat your password","Next","Quit");
}
}
case DIALOG_REGISTER_2:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER_2, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registration",""COL_RED"You entered an incorrect password.\n"COL_WHITE"Please repeat your password","Next","Quit");
if(strcmp(passwd[playerid], inputtext, false, strlen(passwd[playerid])) == 1) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registration",""COL_RED"Password does not match the first password.\n"COL_WHITE"In order to be registered in our server, please enter an password for your account.","Next","Quit");
ShowPlayerDialog(playerid, DIALOG_REGISTER_3, DIALOG_STYLE_INPUT, ""COL_WHITE"Registration",""COL_GREEN"Password successfuly accepted by the server.\n"COL_WHITE"Please enter secret question for your account. (For security purposes)","Next","Quit");
}
}
Re: OnPlayerRequestClass issue -
ReneG - 17.03.2012
On your first Register dialog, you need to either
pawn Код:
return ShowPlayerDialog(DIALOG_REGISTER_2,blahblahblahblah);
or just return 1; Without returning a value, well the register system basically shits its self.
Re: OnPlayerRequestClass issue -
Darth1993 - 17.03.2012
Okay, thank you.
EDIT: Yea, it shits it self. I still go directly to Class selection after first dialog.