When a player registers, it doesn't save the files.
#1

pawn Код:
enum PLAYERSACCOUNT {
        PLAYER_NAME[MAX_PLAYER_NAME],
        PLAYER_IP[16],
        PLAYER_REGGED,
        PLAYER_PASS,
        PLAYER_LOGGED,
        PLAYER_LEVEL,
        PLAYER_ADMIN,
        PLAYER_MUTED,
        PLAYER_JAILED
}
new PlayerAccount[MAX_PLAYERS][PLAYERSACCOUNT];


    new file[100], string[64], Name[MAX_PLAYER_NAME], IP[16];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(file, sizeof(file), PlayerFile, Name);
    format(string, sizeof(string), "%s has joined the server.(Connected)", Name);
    SendClientMessageToAll(COLOUR_GREEN, string);
   
    if(!dini_Exists(file))
    {
        dini_Create(file);
        dini_Set(file, "Name", Name);
        dini_Set(file, "IP", IP);
        dini_IntSet(file, "Registered", -1);
        dini_IntSet(file, "Password", 0);
        dini_IntSet(file, "Level", 0);
        dini_IntSet(file, "Admin Level", 0);
        dini_IntSet(file, "Muted", 0);
        dini_IntSet(file, "Jailed", 0);
        SendClientMessage(playerid, COLOUR_RED, "Your username is not registered on AUS Drift, a box will come up for you to register!");
    }
    strcat(PlayerAccount[playerid][PLAYER_NAME],            dini_Get(file, "Name"));
    strcat(PlayerAccount[playerid][PLAYER_IP],              dini_Get(file, "IP"));
    PlayerAccount[playerid][PLAYER_REGGED]                  =dini_Int(file, "Registered");
    PlayerAccount[playerid][PLAYER_PASS]                    =dini_Int(file, "Password");
    PlayerAccount[playerid][PLAYER_LEVEL]                   =dini_Int(file, "Level");
    PlayerAccount[playerid][PLAYER_ADMIN]                   =dini_Int(file, "Admin Level");
    PlayerAccount[playerid][PLAYER_MUTED]                   =dini_Int(file, "Muted");
    PlayerAccount[playerid][PLAYER_JAILED]                  =dini_Int(file, "Jailed");
    if(PlayerAccount[playerid][PLAYER_REGGED] == 0)          SendClientMessage(playerid, COLOUR_RED, "You're username is not registered, you will be able to register shortly.");
    {
        ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Register", "Please put in a password of your choice.", "Continue", "Cancel");
    }
    if(PlayerAccount[playerid][PLAYER_REGGED] == 1)
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", "Please enter your password.", "Enter", "Cancel");
    }
    PlayerAccount[playerid][PLAYER_REGGED]                  = 1;
    return 1;

All that works, Because i manually put my password and set Registered to 1.

But it doesn't save here

pawn Код:
if(dialogid == 0)
    {
        if(!response)
        {
            SendClientMessage(playerid, COLOUR_RED, "You failed to register!");
            Kick(playerid);
        }
        else
        {
            new string[128];
            new password = strval(inputtext);
            PlayerAccount[playerid][PLAYER_PASS] = password;
            PlayerAccount[playerid][PLAYER_REGGED] = 1;
            PlayerAccount[playerid][PLAYER_LOGGED] = 1;
            GetPlayerIp(playerid, PlayerAccount[playerid][PLAYER_IP], 16);
            format(string, sizeof(string), "%s has joined the game. (Logged in)", PlayerAccount[playerid][PLAYER_NAME]);
            SendClientMessage(playerid, COLOUR_GREEN, "You have successfully registered your account and have been automaticcally logged in.");
            SpawnPlayer(playerid);
        }
        return 1;
    }
No errors, just doesn't save.
Reply
#2

With the last, you store the password to the variable and that's all. You need to create a file if not exists and set the data there, in OnPlayerDisconnect, save the last data and in OnPlayerConnect, set the data to the player.

Last, Dini is out dated. Change to something else which is fastest.
y_ini - The fastest in the files.
MySQL or SQLite - For databases
Reply
#3

Oh, yep. Get what you mean(For once).
Reply
#4

Implemented and testing now.
Reply
#5

Godamnit. Still does it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)