Account doesn't save properly
#1

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)