Save-Load.
#1

.....
Reply
#2

Does it have you authenticate a new account, or does it just overwrite the previously existing account?
Reply
#3

Please show us your OnGameModeInit
Reply
#4

Quote:
Originally Posted by Oskaar1994
Посмотреть сообщение
Please show us your OnGameModeInit
That is not necessary for a player-loading system-..
Reply
#5

Quote:
Originally Posted by nmader
Посмотреть сообщение
Does it have you authenticate a new account, or does it just overwrite the previously existing account?
Yes indeed, its shows ''login'' dialog. But since OnPlayerDisconnect is defined ''SavePlayer(playerid);'' it overwrite old account with all 0 sets and hashed pw is nothing, i mean password dosent exists then...

What do you think?
Reply
#6

Bump,

So i didnt solve this yet.. I start server, register account, relog everything will be fine account load my things are there. But when i restart server or shutdown console and start again, (my account is saved good) when i check scriptfiles all is good, when i login after i closed and started console it shows me login dialog but when i login i spawn at 0,0,0 coords,i dont have my stuffs and yet in scriptfiles my account is fine it's like i logged in with another name but without register part...
When i disconnect from server SavePlayer function rewrote my old account with ''new one'' without password and all statements 0.
As i told, i only have problem with loading on ''first start'' and i cannot locate problem? Since yini load dont have anything with OnGameModeInit, account should be checked when player logins....
Reply
#7

You make folder in scriptfiles/users ?
Reply
#8

Quote:
Originally Posted by SturtIndia
Посмотреть сообщение
You make folder in scriptfiles/users ?
Ofcourse, i defined UserPath locaton. As i said save is good only ''first load'' make problem, i make acc and everything is fine till i dont restart or close console after that my account dont load, when i make another new account and relog all is fine till i dont restart or shutdown console again.
Reply
#9

When you register, does a ini file appear in the directory of your users folder?

I think its something to do with creating the file other than it not loading since it has nothing to load. When you re-connect your variables for that playerid will remain the same unless you reset the variable therefore when your server restarts the data get reset.

Add this above the registration/ login system then tell me the results when you relog.

pawn Код:
public OnPlayerConnect(playerid)
{
    format(PlayerInfo[playerid][Pass], 3, " ");
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pLevel] = 0;
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
        SPD(playerid, dialog_Login, DIALOG_STYLE_PASSWORD, "Authenticate", "Please enter a password below in order to log in.", "Login", "Quit");
    }

    else return SPD(playerid, dialog_Register, DIALOG_STYLE_INPUT, "Authenticate", "Please enter a password below in order to register.", "Register", "Quit");
    return true;
}
You got any code that you could support us when the player registers? That may be the problem, apart from that I had a good look at your code and it all seems to be in a working order!
Reply
#10

Quote:
Originally Posted by Death1300
Посмотреть сообщение
When you register, does a ini file appear in the directory of your users folder?

I think its something to do with creating the file other than it not loading since it has nothing to load. When you re-connect your variables for that playerid will remain the same unless you reset the variable therefore when your server restarts the data get reset.

Add this above the registration/ login system then tell me the results when you relog.

pawn Код:
public OnPlayerConnect(playerid)
{
    format(PlayerInfo[playerid][Pass], 3, " ");
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pLevel] = 0;
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "loadaccount_%s", .bExtra = true, .extra = playerid);
        SPD(playerid, dialog_Login, DIALOG_STYLE_PASSWORD, "Authenticate", "Please enter a password below in order to log in.", "Login", "Quit");
    }

    else return SPD(playerid, dialog_Register, DIALOG_STYLE_INPUT, "Authenticate", "Please enter a password below in order to register.", "Register", "Quit");
    return true;
}
You got any code that you could support us when the player registers? That may be the problem, apart from that I had a good look at your code and it all seems to be in a working order!
I already defined something like this in register dialog function.
Its not problem with creating file since account was created every time and all is fine till i dont restart server then account i login wont load, and ini file will be there will ''all saved variables'' and when i relog i rewrote account with some other sets...
Its not problem in disconnect even if im not logged in to the server and i close and start console my account wont load.

Here is register dialog, to show you what i ment but yet i dont think register has anything with it.

pawn Код:
if(dialogid == dialog_Register)
        {
            if(!response) return Kick(playerid);

            if(response)
            {
                if(!strlen(inputtext)) return SPD(playerid, dialog_Register, DIALOG_STYLE_INPUT, "Authenticate", "Please enter a password below in order to register.", "Register", "Quit");

                new playersip[24];
                new playername3[MAX_PLAYER_NAME];
                GetPlayerName(playerid, playername3, sizeof(playername3));
                GetPlayerIp(playerid, playersip, sizeof(playersip));

                WP_Hash(hashpass, sizeof(hashpass), inputtext);

                PlayerInfo[playerid][Pass] = hashpass;
                PlayerInfo[playerid][pLevel] = 1;
                PlayerInfo[playerid][pHealth] = 50.0;
                PlayerInfo[playerid][pArmour] = 0.0;
                PlayerInfo[playerid][pCash] = 0;
               
                new y,m,d;
                new h,mi,s;
                getdate(y,m,d);
                gettime(h,mi,s);
                format(string,sizeof(string), "(%d/%d/%d) [%d:%d:%d] %s Has registred in under IP %s.",d,m,y,h,mi,s,playername3,playersip);
                PlayerInfo[playerid][pReg] = 0;
                LoginLog(string);

                format(sHolder, sizeof(sHolder), "None");
                SavePlayer(playerid);
                SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
                SpawnPlayer(playerid);
                gPlayerLogged[playerid] = true;
               
               
                SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
                ShowModelSelectionMenu(playerid, skinlistregister, "Please, choose your clothes.");
                SafeSetPlayerPos(playerid, -1424.2418,-291.0264,14.1484);
                SCM(playerid, COLOR_LIGHTRED, "Thank You for registering at {157DEC}blabla{FF6347}.");
                SetPlayerFacingAngle(playerid, 290);
                return true;
            }
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)