30.08.2011, 00:53
First time I've built a user system (I did use a tutorial but it was a shit one). I can't get it to check if the entered text is the same as the password... sounds noobish but meh.
I get no errors or anything, it compiles fine, but it keeps kicking me, even if the passwords right.
pawn Код:
OnPlayerLogin(playerid, password[])
{
new
hashPassword[129],
uFile[35];
format(uFile, 35, "%s.ini", PlayerName(playerid));
INI_ParseFile(uFile, "LoadUserData", .bExtra = true, .extra = playerid);
WP_Hash(hashPassword, 129, password);
if(PlayerInfo[playerid][pBanned] == 1)
{
new banreason = PlayerInfo[playerid][pBanReason];
new string[128];
format(string, sizeof(string), "%s", banreason);
SendClientMessage(playerid, COLOR_LIGHTRED, "This account has been banned:");
SendClientMessage(playerid, COLOR_LIGHTRED, string);
Kick(playerid);
return 0;
}
if(WP_Hash(hashPassword, 129, password) == PlayerInfo[playerid][pPassword])
{
SendClientMessage(playerid, COLOR_ORANGE, "You've logged into Los Santos Gang Wars!");
SetPVarInt(playerid, "Logged", 1);
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "Error: wrong password entered, you've been kicked.");
Kick(playerid);
}
return 1;
}