Sorry but it didn't work
Here is where it's called
pawn Код:
if(dialogid == 2) {
if(!strlen(inputtext)) {
SendClientMessage(playerid, 0xFFFFFFFF, "Your Password Cannot be left Blank"); Kick(playerid);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login to your account","Note - A account with this name was found inside the database,\n If this is your account,type in your password\n if not press cancel!","Login","Cancel");
return 1;
}
if(!response){ SendClientMessage(playerid, 0xFFFFFFFF, "You canceled!"); Kick(playerid); return 0; }
//Encrypt(inputtext);
OnPlayerLogin(playerid,inputtext);
}
this is how i have put it
pawn Код:
public OnPlayerLogin(playerid,password[])
{
if(IsPlayerConnected(playerid)) {
new DataString[128], Query[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format( Query, sizeof( Query ), "SELECT * FROM `players` WHERE `Username` = '%s'",pname);
mysql_query(Query);
mysql_store_result();
if(strlen(password) == 0 || strcmp(password, DataString, false) != 0) return 1;
mysql_fetch_field("id", DataString);
PlayerInfo[playerid][pID] = strval(DataString);
PlayerInfo[playerid][pID] = PlayerInfo[playerid][pID];
mysql_fetch_field("Password", DataString);
PlayerInfo[playerid][pKey] = strval(DataString);
This is what it does after it loads all the data
pawn Код:
mysql_fetch_field("Carkey3", DataString);
PlayerInfo[playerid][pPcarkey3] = strval(DataString);
// }
}
else {
printf("[ERROR] OnplayerLogin() was called, but to a non-connected ID.", playerid);
GetFromAccount(PlayerInfo[playerid][pID], "Password", PlayerInfo[playerid][pKey]);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login to your account","Note - A account with this name was found inside the database,\n If this is your account,type in your password\n if not press cancel!","Login","Cancel");
SendClientMessage(playerid, 0xFFFFFFFF, "Password does not match the username!");
LoginTry[playerid] += 1;
if(LoginTry[playerid] == MAX_TRY) {
SendClientMessage(playerid, COLOR_SYSTEM, "-------------------------------");
SendClientMessage(playerid, COLOR_GREEN, "You Have been banned from blahh");
SendClientMessage(playerid, COLOR_GREEN, "Admin who banned you - SYSTEM");
SendClientMessage(playerid, COLOR_GREEN, "Reason - Failure to login to account maximum times");
SendClientMessage(playerid, COLOR_GREEN, "Type - Perma. Ban");
SendClientMessage(playerid, COLOR_GREEN, "If you wish to complain goto site");
SendClientMessage(playerid, COLOR_SYSTEM, "-Press F8 to take a picture of this-");
SendClientMessage(playerid, COLOR_SYSTEM, "-------------------------------");
//BanEx(playerid, "Failure to login 3 times");
return 1;
}
}
Maybe this will help ya understand how the code works
This is where is sends it to the dialog
pawn Код:
public OnPlayerRequestClass(playerid)
{
SetPlayerCameraPos(playerid, -2604.2324,490.6546,68.6727);
SetPlayerCameraLookAt(playerid, -2381.7639,793.5422,101.3817);
SetPlayerPos(playerid, -2381.7639,793.5422,101.3817);
ClearChat(playerid);
new Query[128], Name[MAX_PLAYER_NAME], EscapedName[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
mysql_real_escape_string(Name, EscapedName);
#pragma unused Name
format(Query, sizeof(Query), "SELECT `id` FROM `players` WHERE `Username` = '%s'", EscapedName);
mysql_query(Query);
mysql_store_result();
//==============================================================================================//
if(mysql_num_rows() >= 1)
{
if(mysql_num_rows() >= 2)
{
//mysql_free_result();
SendClientMessage(playerid, COLOR_WHITE, "There seems to be duplicates of your account, please contact a high-level admin.");
Kick( playerid );
}
else
{
PlayerInfo[playerid][pID] = mysql_fetch_int();
//mysql_free_result();
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login to your account.","Note - A account with this name was found inside the database,\n If this is your account,type in your password\n if not press cancel.","Login","Cancel");
}
return 1;
}
else
{
//mysql_free_result();
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register your account.","Note - A account with this name was not found inside the database.\n if you would like to register this account,\n type in the password you would like to tegister with.","Register","Cancel");
return 1;
}
}