Y_INI Problems..
#1

I've been having this y_ini(Writing/Loading) problem for a quite a while now.
I've tried re-naming the enum, changing it to "GetPlayerScore" etc.
The stuff writes(saves into the /Users/files), but it doesn't seem to load.
Well, I'm not sure which things i will need to give, so i will for now just post the Enums and LoadUser.

pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pScore,
    pKills,
    pDeaths,
    pMuted,
    pVIP,
    pReward//christmas thing
}
pawn Код:
//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");
    }
pawn Код:
//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);
And here's the LoadUser.

pawn Код:
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;
}
As i mentioned, everything writes into the scriptfiles/users/name.blabla, but it doesn't seem to load.
The password, Money(Cash), Kills, Deaths, Muted work, but the other one's don't seem to work.
Reply
#2

Did you write it on register and connect before loading account's

PlayerInfo[playerid][pReward] = 0;
Reply
#3

Quote:
Originally Posted by David (Sabljak)
Посмотреть сообщение
Did you write it on register and connect before loading account's

PlayerInfo[playerid][pReward] = 0;
Yeah i did.

pawn Код:
PlayerTotalKills[playerid] = 0;
    PlayerInfo[playerid][pMuted] = 0;
    PlayerInfo[playerid][pVIP] = 0;
    PlayerInfo[playerid][pReward] = 0;//christmas stuff
pawn Код:
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);
Reply
#4

Can you show me your login dialog script?
Reply
#5

Sure.

pawn Код:
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 basically "copied" everything from a tutorial, but the Score was already bugged, and now other stuff is getting buggy too(The loading problem))
Reply
#6

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
Reply
#7

Quote:
Originally Posted by novan
Посмотреть сообщение
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
I don't really want to change to anything else atm..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)