forward OnPasswordChecked(playerid);
public OnPasswordChecked(playerid)
{
new bool:match = bcrypt_is_equal();
if(match)
{
new userid = PlayerInfo[playerid][UserID];
new query[500];
mysql_format(Database, query, sizeof(query), "SELECT * FROM `characters` WHERE `AccountID` = '%i'", userid);
mysql_pquery(Database, query, "SelectCharForPlayer", "dd", playerid, userid);
}
else
{
new string[300];
format(string, sizeof(string), "Wrong Password!\nPlease type your correct password below.");
Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Exit");
}
return 1;
}
forward SelectCharForPlayer(playerid, userid);
public SelectCharForPlayer(playerid, userid)
{
new charactername[24], characterage, charactergender[50], string[500], charinfo[500];
if(cache_num_rows())
{
for(new i = 0; i < cache_num_rows(); i++)
{
cache_get_value_name(i, "CharacterName", charactername, 24);
cache_get_value_name(i, "CharacterGender", charactergender, 50);
cache_get_value_name_int(i, "CharacterAge", characterage);
format(charinfo, sizeof(charinfo), "{FFFFFF}Name: %s - Gender: %s - Age: %d\n", charactername, charactergender, characterage);
strcat(string, charinfo);
Dialog_Show(playerid, DIALOG_SELECTCHARACTER, DIALOG_STYLE_LIST, "{FFFFFF}Character Selection", string, "Continue", "Exit");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You don't have any character registered on your account ID.");
}
return 1;
}
new userid = PlayerInfo[playerid][UserID]; |
SendClientMessage(playerid, COLOR_WHITE, "You don't have any character registered on your account ID."); |
Check this:
Also, change Make it output the userid itself, so you can make sure the id is actually correct. When you have no mysql errors, the problem will usualy be in one of the variables, so u gotta debug it fist. |
How are you calling BCrypt? It probably isn't passing the playerid to the callback.
|
Dialog:DIALOG_LOGIN(playerid, response, listitem, inputtext[])
{
if(response)
{
new query[500], Password[BCRYPT_HASH_LENGTH];
mysql_format(Database, query, sizeof(query), "SELECT `Password` FROM `players` WHERE `Username` = '%e'", GetName(playerid));
mysql_query(Database, query);
cache_get_value_name(0, "Password", Password, BCRYPT_HASH_LENGTH);
bcrypt_check(inputtext, Password, "OnPasswordChecked", "i", playerid);
}
else
return Kick(playerid);
return 1;
}