05.03.2013, 23:17
Password isn't saved
What is wrong? Please somebody fix that. Thanks in advance
pawn Код:
enum xInfo
{
xPassword[64],
xMoney,
xAdmin
}
new PlayerInfo[MAX_PLAYERS][xInfo];
pawn Код:
public LoadUser_data(playerid,name[],value[])
{
INI_String("Password", PlayerInfo[playerid][xPassword], 64);
INI_Int("Cash", PlayerInfo[playerid][xMoney]);
INI_Int("Admin", PlayerInfo[playerid][xAdmin]);
return 1;
}
pawn Код:
stock UpdatePlayer(playerid)
{
if(pLogged{playerid} == true)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"Password",PlayerInfo[playerid][xPassword]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][xAdmin]);
INI_Close(File);
}
return 1;
}
pawn Код:
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{800000}Error","{686868}Type a password","Login","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"Password",PlayerInfo[playerid][xPassword]);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_Close(File);
}
}
pawn Код:
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(strlen(inputtext) == PlayerInfo[playerid][xPassword])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
pLogged{playerid} = (true);
GivePlayerMoney(playerid, PlayerInfo[playerid][xMoney]);
XSetSpawnInfo(playerid);
UpdatePlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}