enum pInfo
{
pPass,
pCash,
pAdmin,
pScore,
pKills,
pDeaths,
pMuted,
pVIP,
pReward//christmas thing
}
//OnPlayerConnect
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","Type your password below to login.","Login","Quit");
}
//OnPlayerDisconnect
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);//I've tried changing this to "GetPlayerScore(playerid));"
INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted]);
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
INI_WriteInt(File,"Reward",PlayerInfo[playerid][pReward]);//christmas stuff
INI_Close(File);
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Muted",PlayerInfo[playerid][pMuted]);
INI_Int("VIP", PlayerInfo[playerid][pVIP]);
INI_Int("Reward",PlayerInfo[playerid][pReward]);//Christmas stuff
return 1;
}
Did you write it on register and connect before loading account's
PlayerInfo[playerid][pReward] = 0; |
PlayerTotalKills[playerid] = 0;
PlayerInfo[playerid][pMuted] = 0;
PlayerInfo[playerid][pVIP] = 0;
PlayerInfo[playerid][pReward] = 0;//christmas stuff
case DIALOG_REGISTER:
{
if (!response) Kick(playerid);
else
{
if(!strlen(inputtext)) ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registration","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
else
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Muted",0);
INI_WriteInt(File,"VIP",0);
INI_WriteInt(File,"Reward",0);
INI_Close(File);
case DIALOG_LOGIN:
{
if ( !response ) Kick ( playerid );
else
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok","");
}
else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
}
i am using dini and change to y_ini then my server takes a much to save data. i change to dini again then my server is fine. i suggest you use dini
|