[PLS HELP]ini writers desn't writes or reads!
#1

One time it was good, but, this time dini, or y_ini, do not working, i just want to create onds save, but file does not want to be created!

So , Please , tell me what to do, or give me little example from some ini writers/readers!

Just please!
Thank you!
Reply
#2

Do you use dini_Create? Or just write?

Try running as admin if you're using Vista >>
Reply
#3

I used dini_Create, 'm not so stupid

and i'm allway running from admin and i'm using Win 7
Reply
#4

Format the file before you enforce the function.
As an example
pawn Code:
new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "myserver/%s.ini", name);
        dini_Create(file);
        dini_IntSet(file, "...", ...)
I suggest you to get more in touch with y_ini as its way much faster and works better.
Reply
#5

Quote:
Originally Posted by heineken.
View Post
Format the file before you enforce the function.
As an example
pawn Code:
new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "myserver/%s.ini", name);
        dini_Create(file);
        dini_IntSet(file, "...", ...)
I suggest you to get more in touch with y_ini as its way much faster and works better.
thanks for showing dini exmple, but i know how to do it, i cant understand y_ini, and with y_ini my file doesn't want to be created!
Reply
#6

pawn Code:
new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "myserver/%s.ini", name);
    new INI:Acc = INI_Open(file);
    INI_WriteString(Acc, "...", ...);
    INI_WriteInt(Acc, "...", ...);
    INI_Close(Acc);
Dini opens, reads and closes the file everytime you call a function, y_ini opens the file then it reads what you tell him to read and the you close the file, more difficult but if you take a deep look at it, it ends being easy.

A little example when it comes saving all the data

pawn Code:
enum pInfo
    {
    pAdminLevel,
    pScore,
    pMoney,
    }
new PlayerInfo[MAX_PLAYERS][pInfo];
new bool:gPlayerLogged[MAX_PLAYERS];

forward Y_SaveAcc(playerid);

public Y_SaveAcc(playerid)
{
    new pname[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(file, sizeof(file), "myserver/%s.ini", pname);
    if(gPlayerLogged[playerid] == true)
    {
        new INI:Acc = INI_Open(file);
        PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
        PlayerInfo[playerid][pScore] = GetPlayerScore(playerid);
        INI_WriteInt(Acc, "Score", PlayerInfo[playerid][pScore]);
        INI_WriteInt(Acc, "Money", PlayerInfo[playerid][pMoney]);
        INI_WriteInt(Acc, "AdminLevel", PlayerInfo[playerid][pAdminLevel]);
        INI_Close(Acc);
    }
    gPlayerLogged[playerid] = false;
    return 1;
}
When it comes reading use ParseFile, i suggest to just check ****** tutorial.


OH and remember to create the folder ''myserver'' inside scriptfiles one


Use Y_SaveAcc(playerid); inside OnPlayerDissconect or use it for a command you do.
Reply
#7

Thank you very much!
Im gonna use y_ini for my bowling script =)
it used dini before
now it using djson
and i want to add y_ini version...

Thanks a lot for help..you are good man, and scriptrer!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)