12.07.2010, 10:50
(
Последний раз редактировалось [XST]O_x; 12.07.2010 в 18:25.
)
Hey guys.
Seems like an error occurred on my register/login system.
Code:
Indentation fucked up? Probably.
Anyway,after I register it successfully hashes the password,but when I try to log-in,it says incorrect password.
I hope you guys can help me solve this one!
Seems like an error occurred on my register/login system.
Code:
pawn Код:
dcmd_register(playerid, params[])
{
if(dini_Exists(file) || pInfo[playerid][Logged] == 1)
return SendClientMessage(playerid,Red,"ERROR: You are already registered/logged in.");
else if(!params[0])
return SendClientMessage(playerid,Red,"USAGE: /register [password]");
else if(strlen(params) > 10 || strlen(params) < 4)
return SendClientMessage(playerid,Red,"ERROR: Current password lengths are between 4 and 10.");
else
{
new password = num_hash(params);
dini_Create(file);
pInfo[playerid][Password] = password;
dini_IntSet(file, "Password", pInfo[playerid][Password]);
SendClientMessage(playerid, Green,"You are successfuly registered,and logged in,thank you for registering,have fun!");
pInfo[playerid][Logged] = 1;
}
return 1;
}
dcmd_login(playerid, params[])
{
if(!dini_Exists(file))
return SendClientMessage(playerid, Red, "ERROR: Please register before you try to login.");
else if(pInfo[playerid][Logged] == 1)
return SendClientMessage(playerid, Red, "ERROR: You are already logged-in.");
else if(!params[0])
return SendClientMessage(playerid, Red, "USAGE: /login [password]");
else
{
new password = num_hash(params);
if(pInfo[playerid][Password] == password)
{
pInfo[playerid][Logged] = 1;
return SendClientMessage(playerid, lBlue, "You have successfully logged in to your account.");
}
else
return SendClientMessage(playerid, Red, "ERROR: Incorrect password.");
}
}
Anyway,after I register it successfully hashes the password,but when I try to log-in,it says incorrect password.
I hope you guys can help me solve this one!