Account not saving?
#1

This is mine Dialog
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        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, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 250000);
        dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 10);
        dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills] = 0);
        dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths] = 0);
        dini_IntSet(file, "Robberie's",PlayerInfo[playerid][pRobberies] = 0);
        dini_IntSet(file, "Arrest",PlayerInfo[playerid][pArrest] = 0);
        dini_IntSet(file, "Tickets",PlayerInfo[playerid][pTickets] = 0);
        dini_IntSet(file, "Time",PlayerInfo[playerid][pTime] = 0);
        dini_IntSet(file, "BankCash",PlayerInfo[playerid][pBankCash] = 0);
        dini_IntSet(file, "Cars",PlayerInfo[playerid][pCars] = 0);
        dini_IntSet(file, "Warns",PlayerInfo[playerid][pWarns] = 0);
        dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned] = 0);
        dini_IntSet(file, "Kicked",PlayerInfo[playerid][pKicked] = 0);
        dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted] = 0);
        dini_IntSet(file, "OnDuty",PlayerInfo[playerid][pOnDuty] = 0);
        format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        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, "Nice job your registered", "Thanks for registering, your registered. Input your password below", "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, "Nice job your registered", "Thanks for registering, your registered. Input your password below", "Login", "Leave");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Successfully logged in!");
        }
    }
    return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new string[64],
    mens[MAX_PLAYER_NAME];
    GetPlayerName(playerid,mens,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left Amsterdam Cops 'n Robbers! (Timed out)",mens);
        case 1: format(string,sizeof string,"%s left Amsterdam Cops 'n Robbers! (Leaving)",mens);
        case 2: format(string,sizeof string,"%s left Amsterdam Cops 'n Robbers! (Kicked/Banned)",mens);
    }
    SendClientMessageToAll(0x0CED1,string);
   
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
        dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills]);
        dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths]);
        dini_IntSet(file, "Robberie's",PlayerInfo[playerid][pRobberies]);
        dini_IntSet(file, "Arrest",PlayerInfo[playerid][pArrest]);
        dini_IntSet(file, "Tickets",PlayerInfo[playerid][pTickets]);
        dini_IntSet(file, "Time",PlayerInfo[playerid][pTime]);
        dini_IntSet(file, "BankCash",PlayerInfo[playerid][pBankCash]);
        dini_IntSet(file, "Cars",PlayerInfo[playerid][pCars]);
        dini_IntSet(file, "Warns",PlayerInfo[playerid][pWarns]);
        dini_IntSet(file, "Banned",PlayerInfo[playerid][pBanned]);
        dini_IntSet(file, "Kicked",PlayerInfo[playerid][pKicked]);
        dini_IntSet(file, "Muted",PlayerInfo[playerid][pMuted]);
        dini_IntSet(file, "OnDuty",PlayerInfo[playerid][pOnDuty]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}
How to solfe this?


Sorry for my bad English.
Reply
#2

SomeBody?
Reply
#3

Show the define for
pawn Код:
SERVER_USER_FILE
Usually, it's like this :
pawn Код:
#define SERVER_USER_FILE     "CnR/Accounts/%s.ini"
If you didn't create the folder "CnR" and "Accounts" inside it at scriptfiles, the file won't be created.

(Never used dini before, I suggest you to use Y_INI)
Reply
#4

where do you have the onplayerdisconnect? In gamemode or in the filterscript? I had it in filterscript and it didn't work, it had no effect, as if it didnt even exist. I have also made a thread about my problem but nobody knew how to help.
Reply
#5

Quote:

Show the define for

i got that but when i relog my cash and score didnt save

@Hurlocker:
In GM
Reply
#6

Its a day a go so bump

when i fish it gives money but always save's 250k and score on Text File says 10 score but at TAB 0
Reply
#7

No Body?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)