22.01.2013, 22:21
Hmm nope, still no dialog, here's the dialog code:
The indent at:
is just the way I posted the code
pawn Код:
#define DIALOG_LOGIN 2
pawn Код:
case DIALOG_LOGIN: //Dialog login
{
if(!response) //If they click the cancel button
{
Kick(playerid);
}
if(response) //If the player clicked login
{
new query[200], pname[24], escapepass[100];//
GetPlayerName(playerid, pname, 24); //Gets the players name
mysql_real_escape_string(inputtext, escapepass); //We escape the inputtext to avoid SQL injections.
format(query, sizeof(query), "SELECT `user` FROM playerdata WHERE user = '%s' AND password = SHA1('%s')", pname, escapepass);
mysql_query(query);
mysql_store_result();
new numrows = mysql_num_rows();
if(numrows == 1) MySQL_Login(playerid);
//This means that there is a user in the database with the same
//password that we typed, we now proceed by using the login function.
if(!numrows)
{
//This means that the password that the player
//typed was incorrect and we will resend the dialog.
format(string, sizeof(string), "Welcome back, %s. Please enter your password below to log in.", GetName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", string, "Confirm", "Quit");
SendClientMessage(playerid, COLOR_LIGHTRED, "Error{FFFFFF}: You have entered an incorrect password."); //Sends the client a error message
}
mysql_free_result(); //Remember to always free a result if you stored one!
}
return 1;
}
pawn Код:
case DIALOG_LOGIN: //Dialog login