help score/money not saving to file
#1

The score and money is not saving to the file but the levels are plz help heres code
pawn Код:
enum AccInfo
{
    LoggedIn,
    Registered,
    VIP,
    Score,
    Money,
    Level
};
new pInfo[MAX_PLAYERS][AccInfo];

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),"Admin/Accounts/%s.txt",name);
   
    if(dini_Exists(file))
    {
        dini_IntSet(file,"LoggedIn",0);
        dini_IntSet(file, "Score", pInfo[playerid][Score]);
        dini_IntSet(file, "Money", pInfo[playerid][Money]);
        dini_IntSet(file, "VIP", pInfo[playerid][VIP]);
        dini_IntSet(file, "Level", pInfo[playerid][Level]);
        return 1;
    }
    return 1;
}
Reply
#2

Try this:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),"Admin/Accounts/%s.txt",name);
   
    new pScore, pMoney;
    pScore = GetPlayerScore(playerid);
    pMoney = GetPlayerMoney(playerid);
   
    if(dini_Exists(file))
    {
        dini_IntSet(file,"LoggedIn",0);
        dini_IntSet(file, "Score", pScore);
        dini_IntSet(file, "Money", pMoney);
        dini_IntSet(file, "VIP", pInfo[playerid][VIP]);
        dini_IntSet(file, "Level", pInfo[playerid][Level]);
        return 1;
    }
    return 1;
}
Reply
#3

pawn Код:
enum AccInfo
{
    LoggedIn,
    Registered,
    VIP,
    Score,
    Money,
    Level
};
new pInfo[MAX_PLAYERS][AccInfo];

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),"Admin/Accounts/%s.txt",name);

    if(dini_Exists(file))
    {
        dini_IntSet(file,"LoggedIn",0);
        dini_IntSet(file, "Score", GetPlayerScore(playerid));
        dini_IntSet(file, "Money", GetPlayerMoney(playerid));
        dini_IntSet(file, "VIP",pInfo[playerid][VIP] = 0);
        dini_IntSet(file, "Level",pInfo[playerid][Level] = 0);
        return 1;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)