[Include] dini2.inc - Improved dini file processor with amazing benchmarks (aka. gini)!

DOF2_Exit(); Dini = ?
Reply

This is original dini conversion not DOF2.

If you are looking for DOF2 type of syntax, this include does have a new API to it, check the main thread for the list of functions.
Reply

Any sample tutorial using new API?
And 1 more question, when i update to new version from 2.6 to 2.8 my saving system got bug using the old API.
I hope you can solved this. I think i'll be using dini2 version 2.6, it's stable version i ever use.
Reply

I'll put up some examples in the thread and new update coming soon which will get rid of all bugs.
Reply

after using this dini in my script my login/register system got bugged its showing wrong password or sometimes always directly login without password
Reply

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Okay man, here's the deal, i just tried it again (your new update) and i got one filterscript along with my gamemode, for some ambiguous reason it reads but... it won't write to the files on the filterscript, any idea? the code is very simply its literally just dini_Set, i already used print and the code is executed yet it doesn't write to the file.
Okay. I am gonna test the include script thoroughly this time since this update was my final major change to code.

And if you could provide me your filterscript either here or private message so i can test that too. If not thats okay.
Reply

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Okay. I am gonna test the include script thoroughly this time since this update was my final major change to code.

And if you could provide me your filterscript either here or private message so i can test that too. If not thats okay.
As said it's very basic, OnPlayerDisconnect i'm checking if player spawned once, save the integers related to him, then i thought maybe that's the problem, so i used print all over onplayerdisconnect, they all checked out correct which means, the code is executed yet not writing to the file AND SOME are not being read, i'm gonna take a wild guess and say it might be the limits u set but i dunno, thanks for the help btw. If anything here's a small snippet:
PHP код:
if(spawnedonce[playerid])
{
    
GetPlayerPos(playerid,X,Y,Z);
     
GetPlayerFacingAngle(playerid,Angle);
      
dini_IntSet(zefile,"PSCORE",GetPlayerScore(playerid));
     
dini_IntSet(zefile,"Interior",GetPlayerInterior(playerid));
     
dini_IntSet(zefile,"World",GetPlayerVirtualWorld(playerid));
     
dini_IntSet(zefile,"WantedLevel",GetPlayerWantedLevel(playerid));
     if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
     {
         
dini_FloatSet(zefile,"X",X);
         
dini_FloatSet(zefile,"Y",Y);
         
dini_FloatSet(zefile,"Z",Z+1);
         } 
NOTE: When i say it's not writing, i don't mean its not writing values in the fields, i'm saying its not even creating the field. Thanks again really appreciate your effort.
Reply

I did a quick test and seems like everything works fine. Here test it yourself:
PHP код:
main() {
    new const 
file[] = "test.ini";

    
dini_IntSet(file"int"100);
     
dini_FloatSet(file"flt"100.0);
     
dini_Set(file"str""val_set");

     
printf("int = %i"dini_Int(file"int"));
     
printf("flt = %f"dini_Float(file"flt"));
     
printf("str = %s"dini_Get(file"str"));

     
printf("dini_NumKeys = %i"dini_NumKeys(file));
     
printf("dini_Isset = %i"dini_Isset(file"str"));

     
dini_Unset(file"str");
     
printf("dini_Isset = %i"dini_Isset(file"str"));
     
printf("dini_NumKeys = %i"dini_NumKeys(file));

Reply

Quote:
Originally Posted by Gammix
Посмотреть сообщение
I did a quick test and seems like everything works fine. Here test it yourself:
PHP код:
main() {
    new const 
file[] = "test.ini";

    
dini_IntSet(file"int"100);
     
dini_FloatSet(file"flt"100.0);
     
dini_Set(file"str""val_set");

     
printf("int = %i"dini_Int(file"int"));
     
printf("flt = %f"dini_Float(file"flt"));
     
printf("str = %s"dini_Get(file"str"));

     
printf("dini_NumKeys = %i"dini_NumKeys(file));
     
printf("dini_Isset = %i"dini_Isset(file"str"));

     
dini_Unset(file"str");
     
printf("dini_Isset = %i"dini_Isset(file"str"));
     
printf("dini_NumKeys = %i"dini_NumKeys(file));

Can having too many fields prevent it? can i increase any of the #define MAX ones u put?
Reply

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Can having too many fields prevent it? can i increase any of the #define MAX ones u put?
You can have upto "64" fields by default.
To increase it simply do this:
PHP код:
#define DINI_MAX_FIELDS <your limit>
#include <dini2> 
Reply

Quote:
Originally Posted by Gammix
Посмотреть сообщение
You can have upto "64" fields by default.
To increase it simply do this:
PHP код:
#define DINI_MAX_FIELDS <your limit>
#include <dini2> 
Aha okay i'll work on it and get back to you on that, thanks a lot for the support.
Reply

Quote:

E:\Server\Haikal Roleplay\pawno\include\dini2.inc(200) : warning 219: local variable "NULL" shadows a variable at a preceding level

Any solution?
Reply

Quote:
Originally Posted by haikalbintang
Посмотреть сообщение
Any solution?
read this :https://sampforum.blast.hk/showthread.php?tid=648282
and this: https://sampforum.blast.hk/showthread.php?tid=648288
Reply

It's work, thanks dude
Reply

I switched from dini to this.It works well so far,ill give my taughts in near future to confirm the improvement.
Reply

I updated the test results, you can see how slow Dini.inc is from Dini2.inc.

Also test code is updated with a little tutorial on how to perform that test yourself, if you want to satisfy by testing yourself!
Reply

warning 219: local variable "NULL" shadows a variable at a preceding level

hmm? (in dini2, line 200)
Reply

I wouldn't recommend.
Reply

What happens if I don't use dini_timeout when finishing writing a file??
Reply

Quote:
Originally Posted by insus100
Посмотреть сообщение
What happens if I don't use dini_timeout when finishing writing a file??
Then the timer will close the file, its optional; "dini_Timeout" is just for efficiency.
But, If you are writing new code with dini2, you should use this function after Setting/Getting data, its just like any other INI_Close function.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)