SA-MP Forums Archive
[PLS HELP]ini writers desn't writes or reads! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [PLS HELP]ini writers desn't writes or reads! (/showthread.php?tid=248157)



[SOLVED]ini writers desn't writes or reads! - Nexotronix - 12.04.2011

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!


Re: [PLS HELP]ini writers desn't writes or reads! - Jochemd - 12.04.2011

Do you use dini_Create? Or just write?

Try running as admin if you're using Vista >>


Re: [PLS HELP]ini writers desn't writes or reads! - Nexotronix - 12.04.2011

I used dini_Create, 'm not so stupid

and i'm allway running from admin and i'm using Win 7


Respuesta: [PLS HELP]ini writers desn't writes or reads! - kirk - 12.04.2011

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.


Re: Respuesta: [PLS HELP]ini writers desn't writes or reads! - Nexotronix - 12.04.2011

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!


Respuesta: [PLS HELP]ini writers desn't writes or reads! - kirk - 12.04.2011

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.


Re: [PLS HELP]ini writers desn't writes or reads! - Nexotronix - 12.04.2011

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!