i have problem with my register system, it always detect as incorrect password even i type it correct
example, my password is rlrp, when i login and type rlrp, it detects as wrong password
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new buffer[129], str[128];
if(dialogid == INTRODUCTION)
{
if(!response) return Kick(playerid);
else if(response)
{
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", "Welcome come back in Resident's Life Roleplay\nPlease type your password to access your account!", "Login", "Quit");
}
else
{
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "Registering...", "Welcome to Resident's Life Roleplay\nPlease type your password to create new account!", "Register", "Quit");
}
}
}
if(dialogid == REGISTER)
{
if (!response) return Kick(playerid);
else if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "Registering...", ""COL_RED"You have entered the field BLANK\n"COL_WHITE"Please type your password to create new account!", "Register", "Quit");
new INI:File = INI_Open(Path(playerid));
WP_Hash(buffer, sizeof(buffer), inputtext);
INI_SetTag(File, "data");
INI_WriteString(File, "Password", buffer);
INI_WriteInt(File, "Tutorial", PlayerInfo[playerid][pJoin] = 0);
INI_WriteInt(File, "Selected", PlayerInfo[playerid][pSelected]);
INI_WriteInt(File, "Level", PlayerInfo[playerid][pLevel] = 1);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
INI_WriteInt(File, "Cash", PlayerInfo[playerid][pCash] = 0);
INI_WriteInt(File, "Admin", PlayerInfo[playerid][pAdmin] = 0);
INI_WriteInt(File, "Helper",PlayerInfo[playerid][pHelper] = 0);
INI_WriteInt(File, "Vip", PlayerInfo[playerid][pVip] = 0);
INI_WriteInt(File, "Spawn", PlayerInfo[playerid][pSpawn] = 1);
INI_WriteInt(File, "Model", PlayerInfo[playerid][pModel] = 23);
INI_WriteInt(File, "Locked", PlayerInfo[playerid][pLocked] = 0);
INI_WriteInt(File, "Continent", PlayerInfo[playerid][pPlace] = 0);
INI_WriteInt(File, "Sex", PlayerInfo[playerid][pSex] = 0);
INI_WriteInt(File, "Age", PlayerInfo[playerid][pAge] = 0);
INI_WriteInt(File, "Gender", PlayerInfo[playerid][pGender] = 0);
INI_WriteInt(File, "Origin", PlayerInfo[playerid][pOrigin] = 0);
INI_WriteInt(File, "Respect", PlayerInfo[playerid][pExp] = 0);
INI_WriteInt(File, "Warns", PlayerInfo[playerid][pWarns] = 0);
INI_WriteInt(File, "Muted", PlayerInfo[playerid][pMuted] = 0);
INI_WriteInt(File, "MuteTime", PlayerInfo[playerid][pMuteTime] = 0);
new rp = 100000 + random(899999);
INI_WriteInt(File, "CellNo", PlayerInfo[playerid][pNumber] = rp);
INI_WriteInt(File, "DriveLic",PlayerInfo[playerid][pDriveLic] = 0);
INI_Close(File);
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
ClearChat(playerid);
}
}
if(dialogid == LOGIN)
{
if(!response) return Kick(playerid);
else if(response)
{
INI_ParseFile(Path(playerid), "LoadUserData", .bExtra = true, .extra = playerid); //I don't now what is this xD
WP_Hash(buffer, sizeof(buffer), inputtext);
if(strcmp(PlayerInfo[playerid][pPass], buffer, true) == 0)
{
INI_ParseFile(Path(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SpawnPlayer(playerid);
PlayerInfo[playerid][pLog] = 1;
SetPlayerCash(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
ClearChat(playerid);
}
else
{
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", ""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Please type your password to access your account!", "Login", "Quit");
}
}
}
if(dialogid == GENDER)
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pGender] = 1;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are Male");
ShowPlayerDialog(playerid, AGE, DIALOG_STYLE_INPUT, "What is your age?", "How old are you?", "Next", "Leave Game");
}
else if(listitem == 1)
{
PlayerInfo[playerid][pGender] = 2;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are Female");
ShowPlayerDialog(playerid, AGE, DIALOG_STYLE_INPUT, "What is your age?", "How old are you?", "Next", "Leave Game");
}
}
else
{
Kick(playerid);
}
}
if(dialogid == AGE)
{
if(response)
{
PlayerInfo[playerid][pAge] = strval(inputtext);
format(str, sizeof(str), "So you are %s years old", inputtext);
SendClientMessage(playerid, COLOR_YELLOW2, str);
new sexthings[] = "Europe\nAmerica\nAsia";
if(strval(inputtext) <= 11)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: This is a 12+ Only Server, Grow up and Come Back.");
Kick(playerid);
return 1;
}
if(strval(inputtext) >= 61)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Incorrect Age, You need to enter a Real Age.");
ShowPlayerDialog(playerid, AGE, DIALOG_STYLE_INPUT, "What is your age?", "How old are you?", "Next", "Leave Game");
return 1;
}
ShowPlayerDialog(playerid, CONTINENT, DIALOG_STYLE_LIST, "Where are you from?", sexthings, "Select", "Leave Game");
}
else
{
Kick(playerid);
}
}
if(dialogid == CONTINENT)
{
if(response)
{
if (listitem == 0)
{
PlayerInfo[playerid][pPlace] = 1;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from the Europe.");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
else if (listitem == 1)
{
PlayerInfo[playerid][pPlace] = 2;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from United States (U.S).");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
else if (listitem == 2)
{
PlayerInfo[playerid][pPlace] = 3;
SendClientMessage(playerid, COLOR_YELLOW2, "So you are from Asia.");
gPlayerRegStep[playerid] = 0;
PlayerInfo[playerid][pSelected] = 1;
}
PlayerInfo[playerid][pLog] = 1;
TogglePlayerControllable(playerid, 1);
if(PlayerInfo[playerid][pJoin] == 0)
{
TogglePlayerControllable(playerid, 0);
PlayerInfo[playerid][pTut] = 1;
SetPlayerHealth(playerid, 100);
SetPlayerPos(playerid, 1412.8313, -1700.3066, 13.5395);
SetPlayerCameraPos(playerid, 1412.8313, -1700.3066, 13.5395);
SetPlayerCameraLookAt(playerid, 1412.8313, -1700.3066, 13.5395);
format(str, sizeof(str), "This is the Driving School, you will be able ~n~to take a drive test wich will cost you~n~100$ so you will get a Driving License.~n~REMEBER:The police stops you if you~n~don't have one.");
TextDrawSetString(Tutorial[playerid], str);
TextDrawShowForPlayer(playerid, Tutorial[playerid]);
SendClientMessage(playerid, COLOR_WHITE, "{248B10}Tutorial:{FFFFFF}Use SPACEBAR to continue, SHIFT to go back.");
}
}
else
{
Kick(playerid);
}
}
return 1;
}
Check your user file, see if any information is actually saving to it.
I've noticed a common problem with Y_INI is the file only creating, and not saving any information to it.
Try to Manually input Password-PASSWORDHERE into the user file(If No data was saved.)
That will at-least tell you that it's not the loading - but instead the saving.
It saving fine. All fine.
Never mind i fix it myself.