14.12.2013, 07:55
(
Последний раз редактировалось Sawalha; 14.12.2013 в 11:47.
)
hello, when i save my password with y_ini and using wp for hashing pass, ok it's saves the hash but when i login, when i login with the incorrect password, it logins, same with correct password, logins, but the problem is why incorrect password logins?
code:
other
dialog responses
login
Thanks..
code:
pawn Код:
// this is the loading code
forward LoadUser_Data(playerid, name[], value[]);
public LoadUser_Data(playerid, name[], value[])
{
INI_String("Password", PlayerInfo[playerid][Password], 129);
INI_Int("Score", PlayerInfo[playerid][Score]);
INI_Int("Deaths", PlayerInfo[playerid][Deaths]);
INI_Int("Level", PlayerInfo[playerid][Level]);
INI_Int("Kills", PlayerInfo[playerid][Kills]);
INI_Int("Cash", PlayerInfo[playerid][Cash]);
INI_Int("Zones", PlayerInfo[playerid][Zones]);
return 1;
}
pawn Код:
// At onplayerdisconnect
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",PlayerInfo[playerid][Cash] = GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][Level]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
INI_WriteInt(File, "Score", PlayerInfo[playerid][Score] = GetPlayerScore(playerid));
INI_WriteInt(File, "Zones", PlayerInfo[playerid][Zones]);
INI_Close(File);
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_REGISTER:
{
if(!response)
{
SendClientMessage(playerid, RED, "[SYSTEM] okay, You may register Later! use /register...");
ShowPlayerDialog(playerid, DIALOG_TEAMS, DIALOG_STYLE_LIST, "Select a Team", "{0019FF}United States Of America\n {FFFA00}Asian Army", "Select", "Cancel");
}
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD," Register |", "You may register now if you wish", "OK", "Later");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "data");
new hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), inputtext);
INI_WriteString(File, "Password", hashpass);
INI_WriteInt(File, "Level", PlayerInfo[playerid][Level]);
INI_WriteInt(File, "Score", PlayerInfo[playerid][Score] = GetPlayerScore(playerid));
INI_WriteInt(File, "Cash", PlayerInfo[playerid][Cash] = GetPlayerMoney(playerid));
INI_WriteInt(File, "Kills", PlayerInfo[playerid][Kills]);
INI_WriteInt(File, "Deaths", PlayerInfo[playerid][Deaths]);
INI_WriteInt(File, "Zones", PlayerInfo[playerid][Zones]);
INI_Close(File);
SendClientMessage(playerid, GREEN, "You have been sucessfully in registering!");
ShowPlayerDialog(playerid, DIALOG_TEAMS, DIALOG_STYLE_LIST, "Select a Team", " {0019FF}United States Of America\n {FFFA00}Asian Army", "Select", "Cancel");
return 1;
}
}
pawn Код:
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), inputtext);
if(!strcmp(hashpass, PlayerInfo[playerid][Password], false))
{
INI_ParseFile(UserPath(playerid), "LoadData_%s", .bExtra = true, .extra = playerid);
SendClientMessage(playerid, GREEN, " - - - - - USER STATS INFORMATION - - - - ");
SendClientMessage(playerid, GREEN, " - - - - SYSTEM HAS LOADED SUCESSFULLY- - - - - ");
ShowPlayerDialog(playerid, DIALOG_TEAMS, DIALOG_STYLE_LIST, "Select a Team", "{0019FF}United States Of America\n {FFFA00}Asian Army", "Select", "Cancel");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "This account is registered please login", "OK", "Cancel");
SendClientMessage(playerid, RED, "Wrong Password");
return 1;
}
}
}