16.12.2012, 17:52
I seem to be having a bit of trouble getting YINI and Whirlpool to correspond together. Basically the password does save and does undergo Whirlpool's hashing; however it is not properly logging in as it says all passwords are incorrect.
The code:
Notice that the final code is just a portion and there are others but it was isolated as it looked to be the issue within the script.
Any and all help will be greatly appreciated; however reputation cannot be guaranteed.
~Nmader
The code:
pawn Код:
public loadaccount(playerid, name[], value[])
{
INI_String("Password", pInfo[playerid][Pass],129);
INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
INI_Int("DonatorLevel",pInfo[playerid][DonatorLevel]);
INI_Int("Money",pInfo[playerid][Money]);
INI_Int("BankMoney",pInfo[playerid][BankMoney]);
INI_Int("Level",pInfo[playerid][Level]);
INI_Int("Experience",pInfo[playerid][Experience]);
INI_Int("Kills",pInfo[playerid][Kills]);
INI_Int("Deaths",pInfo[playerid][Deaths]);
INI_Int("Military",pInfo[playerid][Military]);
INI_Int("MilitaryRank",pInfo[playerid][MilitaryRank]);
INI_Int("MilitaryCustomRank",pInfo[playerid][MilitaryCustomRank]);
INI_Int("SpawnSelection",pInfo[playerid][SpawnSelection]);
INI_Int("Skin",pInfo[playerid][Skin]);
INI_Int("Citizenship",pInfo[playerid][Citizenship]);
return 1;
}
pawn Код:
forward loadaccount(playerid, name[], value[]);
pawn Код:
public OnPlayerConnect(playerid)
{
SetPlayerColor(playerid, -1);
new string[128], Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
format(string, sizeof(string), "Users/%s.ini", Name);
INI_ParseFile(Path(playerid),"loadaccount", .bExtra = true, .extra = playerid);
SetSpawnInfo(playerid, -1, pInfo[playerid][Skin], -1, -1, -1, 0, -1, -1, -1, -1, -1, -1);
new string3[128];
new string2[128];
format(string3, sizeof(string3), "Welcome to Call of Vengeance Roleplay, %s! {00FF00}[CoV:RP V0.0.1.2 | Copyright© 2012 Nathan Mader]", getFirstName(playerid));
SendClientMessage(playerid, 0xBFBFBFFF, string3);
if(fexist(string))
{
format(string2, sizeof(string2), "Welcome back to Call of Vengeance Roleplay, {00FFFF}%s!\n{FFFFFF}You have an account, please enter your password to continue!", pRPName(Name));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string2, "Login", "Quit");
}
if(!fexist(string))
{
format(string2, sizeof(string2), "Welcome to Call of Vengeance Roleplay, {00FFFF}%s!\n{FFFFFF}Please enter a desired password below to continue!", pRPName(Name));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register...", string2, "Register", "Cancel");
}
return 1;
}
pawn Код:
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid, 0x6F6F6FFF, "ERROR: You must entered a password! (No attempts have been legitimately made)");
new string2[128];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
format(string2, sizeof(string2), "Welcome back to Call of Vengeance Roleplay, {0000FF}%s!\n{FFFFFF}You have an account, please enter your password to continue!", pRPName(Name));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string2, "Login", "Quit");
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{
SetPlayerScore(playerid,pInfo[playerid][Level]);
GivePlayerMoney(playerid,pInfo[playerid][Money]);
SpawnPlayer(playerid);
pInfo[playerid][PlayerLoggedIn] = 1;
}
else
{
if(pInfo[playerid][WrongPass] >= 3)
{
Kick(playerid);
}
else if(pInfo[playerid][WrongPass] < 3)
{
pInfo[playerid][WrongPass]++;
new string2[128];
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
SendClientMessage(playerid, 0x6F6F6FFF, "ERROR: You have entered an invalid password!");
format(string2, sizeof(string2), "Welcome back to Call of Vengeance Roleplay, {0000FF}%s!\n{FFFFFF}You have an account, please enter your password to continue!", pRPName(Name));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string2, "Login", "Quit");
return 1;
}
}
}
}
Any and all help will be greatly appreciated; however reputation cannot be guaranteed.
~Nmader