Dini saving problem :/ (+ rep)
#9

Quote:
Originally Posted by Dwane
Посмотреть сообщение
pawn Код:
#include <a_samp>
#include <dini>

#define MyFile  "Points/%s.ini"
// Create a floder inside Scriptfiles called 'Points'
enum pInfo
{
    Score
}
new PlayerInfo[MAX_PLAYERS][pInfo];

public OnPlayerConnect(playerid)
{
    new File[68];
    new Name[MAX_PLAYER_NAME];

    GetPlayerName(playerid, Name, sizeof(Name));
    format(File, sizeof(File), MyFile, Name);
    if(!dini_Exists(File)) {
        dini_Create(File);
        dini_Set(File, "Name", Name);
        dini_IntSet(File, "Points", 0);
    }
    else {
        PlayerInfo[playerid][Score]= dini_Int(File, "Points");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new File[68];
    new Name[MAX_PLAYER_NAME];

    GetPlayerName(playerid, Name  , sizeof(Name));
    format(File, sizeof(File) , MyFile , Name);
    if(dini_Exists(File)) {
        dini_IntSet(File, "Points", PlayerInfo[playerid][Score]);
    }
    return 1;
}
To save them after closing the console, you have to use the same part from OnPlayerDisconnect to OnFilterScriptExit but with loop or foreach.
Thank you for your help, but it still doesn't save any file.
Reply


Messages In This Thread
Dini saving problem :/ (+ rep) - by SpiritEvil - 07.01.2012, 18:23
Re: Dini saving problem :/ (+ rep) - by Steven82 - 07.01.2012, 18:27
Re: Dini saving problem :/ (+ rep) - by Psymetrix - 07.01.2012, 18:27
Re: Dini saving problem :/ (+ rep) - by SpiritEvil - 07.01.2012, 18:37
Re: Dini saving problem :/ (+ rep) - by SpiritEvil - 07.01.2012, 20:02
Re: Dini saving problem :/ (+ rep) - by DonWade - 07.01.2012, 21:31
Re: Dini saving problem :/ (+ rep) - by SpiritEvil - 08.01.2012, 10:01
Re: Dini saving problem :/ (+ rep) - by Konstantinos - 08.01.2012, 10:14
Re: Dini saving problem :/ (+ rep) - by SpiritEvil - 08.01.2012, 10:27
Re: Dini saving problem :/ (+ rep) - by Konstantinos - 08.01.2012, 10:32

Forum Jump:


Users browsing this thread: 1 Guest(s)