SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 12/04/2011, 02:04 PM   #1
Nexotronix
Huge Clucker
 
Nexotronix's Avatar
 
Join Date: Jan 2010
Location: Donetsk/Ukraine
Posts: 277
Reputation: 41
Default [SOLVED]ini writers desn't writes or reads!

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!
__________________
Work In Progress:
[GameMode]Stroberia RolePlay (20%) [Join My Channel to take part in Testing http://discord.gg/sBpRC5E]
Development Video: Watch Here
Serverside Map/GPS System: Watch Here
Discord: Tom_Strobe#2300

Last edited by Nexotronix; 12/04/2011 at 05:01 PM.
Nexotronix is offline  
Old 12/04/2011, 02:24 PM   #2
Jochemd
High-roller
 
Jochemd's Avatar
 
Join Date: Jul 2009
Location: The Netherlands
Posts: 2,220
Reputation: 844
Default Re: [PLS HELP]ini writers desn't writes or reads!

Do you use dini_Create? Or just write?

Try running as admin if you're using Vista >>
__________________
Jochemd is offline  
Old 12/04/2011, 02:41 PM   #3
Nexotronix
Huge Clucker
 
Nexotronix's Avatar
 
Join Date: Jan 2010
Location: Donetsk/Ukraine
Posts: 277
Reputation: 41
Default Re: [PLS HELP]ini writers desn't writes or reads!

I used dini_Create, 'm not so stupid

and i'm allway running from admin and i'm using Win 7
__________________
Work In Progress:
[GameMode]Stroberia RolePlay (20%) [Join My Channel to take part in Testing http://discord.gg/sBpRC5E]
Development Video: Watch Here
Serverside Map/GPS System: Watch Here
Discord: Tom_Strobe#2300
Nexotronix is offline  
Old 12/04/2011, 03:44 PM   #4
kirk
Huge Clucker
 
Join Date: Oct 2010
Posts: 220
Reputation: 75
Default Respuesta: [PLS HELP]ini writers desn't writes or reads!

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.
__________________
kirk is offline  
Old 12/04/2011, 04:10 PM   #5
Nexotronix
Huge Clucker
 
Nexotronix's Avatar
 
Join Date: Jan 2010
Location: Donetsk/Ukraine
Posts: 277
Reputation: 41
Default Re: Respuesta: [PLS HELP]ini writers desn't writes or reads!

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!
__________________
Work In Progress:
[GameMode]Stroberia RolePlay (20%) [Join My Channel to take part in Testing http://discord.gg/sBpRC5E]
Development Video: Watch Here
Serverside Map/GPS System: Watch Here
Discord: Tom_Strobe#2300
Nexotronix is offline  
Old 12/04/2011, 04:18 PM   #6
kirk
Huge Clucker
 
Join Date: Oct 2010
Posts: 220
Reputation: 75
Default Respuesta: [PLS HELP]ini writers desn't writes or reads!

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.
__________________
kirk is offline  
Old 12/04/2011, 05:01 PM   #7
Nexotronix
Huge Clucker
 
Nexotronix's Avatar
 
Join Date: Jan 2010
Location: Donetsk/Ukraine
Posts: 277
Reputation: 41
Default Re: [PLS HELP]ini writers desn't writes or reads!

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!
__________________
Work In Progress:
[GameMode]Stroberia RolePlay (20%) [Join My Channel to take part in Testing http://discord.gg/sBpRC5E]
Development Video: Watch Here
Serverside Map/GPS System: Watch Here
Discord: Tom_Strobe#2300
Nexotronix is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dini reads wrongly! Himynameis Server Support 3 11/12/2010 05:15 PM
[Tuts4Nubs]I wants a cig in ma hand when I writes /smoke!!! Thrarod Help Archive 4 08/04/2010 03:45 PM
samp only reads 7788 ports? y UNCLEMURDA Client Support 2 06/05/2009 10:04 PM


All times are GMT. The time now is 05:21 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.