14.03.2012, 14:31
Guys good day
i have problem with my login system
i have typed the correct password but still it will say error please i need help
here is the code
Guys i need help thanks +rep
i have problem with my login system
i have typed the correct password but still it will say error please i need help
here is the code
pawn Код:
case D_LOGIN:
{
if(!response) return Kick(playerid);
if(response)
{
if(udb_hash(inputtext) == pData[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, pData[playerid][pMoney]);
SendClientMessage(playerid,C_BOT,"iBot:"CWHITE" You have successfully login the server");
}
else
{
new name[MAX_PLAYER_NAME],bstring[500];
GetPlayerName(playerid,name,sizeof(name));
format(bstring,500,""CWHITE"User Name: %s \n\n"CRED"Your password is Error please enter the password correctly"CWHITE" \n\nPlease enter your password bellow to Login.",name);
ShowPlayerDialog(playerid,D_LOGIN,PASSWORD,""CRED"Please Enter your password",bstring,"Login","Quit");
}
return 1;
}
}
}
pawn Код:
new INI:Data = INI_Open(UserPath(playerid));
INI_SetTag(Data,"file");
INI_WriteInt(Data,"Password",udb_hash(inputtext));
INI_WriteInt(Data,"Money",0);
INI_WriteInt(Data,"Admin",0);
INI_Close(Data);
pawn Код:
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}