Saving problems
#1

Hello everyone. I have some saving problems.
When I register and login for the first time, nothing saves into my userfile.
When I relog and do things it does save.
How to fix it that when you log in for the very first time everything will be saved as well?

pawn Код:
if(dialogid == 1)
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(file, sizeof(file), SERVER_USER_FILE, Name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register", "Welcome, your not registered, please fill in a password", "Register", "Leave");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",0);
        dini_IntSet(file, "Money",0);
        dini_IntSet(file, "Score",0);
        dini_IntSet(file, "Gender",0);
        dini_IntSet(file, "Age",0);
        SpawnPlayer(playerid);
        SetCameraBehindPlayer(playerid);
        format(String, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", Name, inputtext);
        SendClientMessage(playerid, COLOR_GREEN, String);
        gPlayerLogged[playerid] = 1;
        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "_", "Welcome to Infinity Roleplay.\nBefore you can play and have fun with our players,\nwe have to ask you a few questions.", "Continue","");

    }
    if (dialogid == 2)
    {
        GetPlayerName(playerid, Name, sizeof(Name));
        format(file, sizeof(file), SERVER_USER_FILE, Name);
        if(!response) return Kick(playerid);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp)
        {
            SendClientMessage(playerid, COLOR_RED, "Wrong password");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            PlayerInfo[playerid][pScore] = dini_Int(file, "Score");
            PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
            PlayerInfo[playerid][pGender] = dini_Int(file, "Gender");
            PlayerInfo[playerid][pAge] = dini_Int(file, "Age");
            Save[playerid] = SetTimerEx("SaveStats",1000,true,"i",playerid);
            SendClientMessage(playerid,COLOR_GREEN, "Successfully logged in!");
            SpawnPlayer(playerid);
            SetCameraBehindPlayer(playerid);
        }

    }
Tell me if you need more.


Thanks in advance.
Reply


Messages In This Thread
Saving problems - by bartje01 - 24.06.2011, 11:01
Re: Saving problems - by Skaizo - 24.06.2011, 11:11
Re: Saving problems - by bartje01 - 24.06.2011, 11:36
Re: Saving problems - by Skaizo - 24.06.2011, 11:55
Re: Saving problems - by bartje01 - 24.06.2011, 12:05
Re: Saving problems - by bartje01 - 24.06.2011, 13:25
Re: Saving problems - by Wesley221 - 24.06.2011, 14:33
Re: Saving problems - by bartje01 - 24.06.2011, 14:43
Re: Saving problems - by Wesley221 - 24.06.2011, 14:52
Re: Saving problems - by bartje01 - 24.06.2011, 15:04

Forum Jump:


Users browsing this thread: 1 Guest(s)