29.08.2012, 23:24
Hey guys, the bug is when the player registers it saves the password okay? but when he comes to log-in, it doesn't read his password .. he can type any password and just log-in and even without logging in his stats can be loaded, so
here are my /login and /register commands (I converted them from Dialogs to commands)
here are my /login and /register commands (I converted them from Dialogs to commands)
pawn Код:
CMD:login(playerid, params[])
{
//if(PlayerInfo[playerid][pPass] == playerpassword
//new tmp;
//new INI:File = INI_Open(UserPath(playerid));
//tmp = INI_Int(File,"Password",PlayerInfo[playerid][pPass]);
if(sscanf(params,"s[128]",playerpassword)) return SendClientMessage(playerid, COLOR_ORANGE,"[REGISTRATION]/login <password>");
if(strcmp(PlayerInfo[playerid][pPass],playerpassword,true))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
}
else
{
SendClientMessage(playerid, COLOR_RED,""#COL_RED"You've entered a wrong password, try again!");
}
return 1;
}
CMD:register(playerid, params[])
{
if(sscanf(params,"s[128]",playerpassword)) return SendClientMessage(playerid, COLOR_ORANGE,"[REGISTRATION]/register <password>");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,".:-{ Player's Data }-:.");
INI_WriteString(File,"Password", playerpassword);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",-1);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Zombie",0);
INI_WriteInt(File,"Score",1);
INI_WriteInt(File,"Team",-1);
INI_Close(File);
PlayerInfo[playerid][pTeam] = -1;
PlayerInfo[playerid][pAdmin] = -1;
SavePlayerStats(playerid);
SendClientMessage(playerid, COLOR_ORANGE, "Congratulations! You have registered yourself and we're happy to have you here!");
SendClientMessage(playerid, COLOR_RED,""#COL_GREEN"Type /starter for your starter pack.");
return 1;
}