SA-MP Forums Archive
Account doesn't save properly - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Account doesn't save properly (/showthread.php?tid=314370)



Account doesn't save properly - Bartels - 29.01.2012

Hello,

When I register an account on my server and try to quit and log back on it first tells me I have to register, but when I try to register again it does tell me the account is already taken. Any ideas?


The piece you get onplayerconnect
pawn Код:
GetPlayerName(playerid, plname, sizeof(plname));
    format(string, sizeof(string), "users/%s.ini", plname);
    if(fexist(string))
    {
        gPlayerAccount[playerid] = 1;
        SendClientMessage(playerid, COLOR_YELLOW, "SERVER: That name is registered, please wait to login.");
        SendClientMessage(playerid, COLOR_WHITE, "HINT: You can now login by typing your password below");
        DisplayDialogForPlayer(playerid, 1); //login
        return 1;
    }
    else
    {
        gPlayerAccount[playerid] = 0;
        SendClientMessage(playerid,COLOR_YELLOW,"You dont have an account. Please register your account to proceed");
        DisplayDialogForPlayer(playerid, 2); //register
        return 1;
    }
}
The part that tells me the account is already taken:
pawn Код:
new string[128];
                format(string, sizeof(string), "users/%s.ini", sendername);
//              if(dini_Exists(string))
                if(fexist(string))
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "That name is already taken, please choose a different one.");
                    return 1;
Edit: I fixed it by changing

pawn Код:
new plname[MAX_PLAYER_NAME];
         new string[MAX_PLAYER_NAME];
to
pawn Код:
new plname[128];
     new string[128];
under onplayerconnect


Re: Account doesn't save properly - Ricop522 - 29.01.2012

You don't need a plname with 128, just do MAX_PLAYER_NAME and stay with string in 128.


Re: Account doesn't save properly - Max_Coldheart - 29.01.2012

Yeah, you should have
pawn Код:
new plname[MAX_PLAYER_NAME];
new string[128];