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

Update dini2.inc v2.6:
- Fixed index misplacing bug
- Fixed double value adding bug
- String hashing as been removed and normal loop has been resumed back!
- It is really fast still, benchmarks has been updated.

If you find any bugs, post them here
Reply
#82

error 004: function "dini_GetFileIndex" is not implemented

what's wrong?
Reply
#83

Quote:
Originally Posted by JokeyL
Посмотреть сообщение
error 004: function "dini_GetFileIndex" is not implemented

what's wrong?
Fixed, it was static instead of stock!
Reply
#84

error 017: undefined symbol "empty"

error 035: argument type mismatch (argument 3) 272, 306:

format(diniFileValues[index][i], DINI_MAX_FIELD_VALUE, value);
format(diniFileValues[index][i], DINI_MAX_FIELD_VALUE, value);
Reply
#85

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Can you add ignore case in dini_exists?
....
Reply
#86

Quote:
Originally Posted by JokeyL
Посмотреть сообщение
error 017: undefined symbol "empty"

error 035: argument type mismatch (argument 3) 272, 306:

format(diniFileValues[index][i], DINI_MAX_FIELD_VALUE, value);
format(diniFileValues[index][i], DINI_MAX_FIELD_VALUE, value);
Made a quick update from my phone, try it out and let me know.

Quote:
Originally Posted by iLearner
Посмотреть сообщение
....
I can make it like so but it would be highly inefficient since you have to loop through alot of stuff. There are some other smart ways, like creating all files in lowercase or uppercase.
Reply
#87

Hi Gammix
fix it
line 272 GitHub
PHP код:
valstr(diniFileValues[index], value); 
valstr(diniFileValues[index][i], value);
Reply
#88

I don't know why, but when i save player moneys:

dini_IntSet(string, "pMoneys", GetPlayerMoney(playerid));

then value in file is -1030672120
Reply
#89

I think this should be iDini, not Dini2... because there is no API change, right?
Reply
#90

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Made a quick update from my phone, try it out and let me know.


I can make it like so but it would be highly inefficient since you have to loop through alot of stuff. There are some other smart ways, like creating all files in lowercase or uppercase.
I really need a way to ignore case cause this is being highly abused at my server.
Reply
#91

How convert this?

Quote:

public SaveAccounts()
{
new respect, string[128];
foreach(new i : Player)
{
if(Logged[i])
{
format(string, sizeof(string), "Accounts/%s.ini", LinuxName[i]);
new File: account = fopen(string, io_write);
if(account)
{
format(string, sizeof(string), "Key=%s\n", PlayerInfo[i][pKey]); dini_Set(account, string);
format(string, sizeof(string), "LoserLevel=%d\n", PlayerInfo[i][pLoserLevel]); dini_Set(account, string);
format(string, sizeof(string), "Name=%s\n", PlayerInfo[i][pName]); dini_Set(account, string);
format(string, sizeof(string), "Level=%d\n", PlayerInfo[i][pLevel]); dini_Set(account, string);
format(string, sizeof(string), "AdminLevel=%d\n", PlayerInfo[i][pAdmin]); dini_Set(account, string);
format(string, sizeof(string), "DonateRank=%d\n", PlayerInfo[i][pPremium]); dini_Set(account, string);
format(string, sizeof(string), "UpgradePoints=%d\n", PlayerInfo[i][pUpPoints]); dini_Set(account, string);
format(string, sizeof(string), "ConnectedTime=%d\n", PlayerInfo[i][pHours]); dini_Set(account, string);
format(string, sizeof(string), "Registered=%d\n", PlayerInfo[i][pReg]); dini_Set(account, string);
format(string, sizeof(string), "Sex=%d\n", PlayerInfo[i][pSex]); dini_Set(account, string);
format(string, sizeof(string), "Age=%d\n", PlayerInfo[i][pAge]); dini_Set(account, string);
format(string, sizeof(string), "Origin=%s\n", PlayerInfo[i][pOrigin]); dini_Set(account, string);
format(string, sizeof(string), "SAO=%d\n", PlayerInfo[i][pFactionPayday]); dini_Set(account, string);
format(string, sizeof(string), "Muted=%d\n", PlayerInfo[i][pMuted]); dini_Set(account, string);
format(string, sizeof(string), "Respect=%d\n", PlayerInfo[i][pExp]); dini_Set(account, string);
format(string, sizeof(string), "Money=%d\n", PlayerInfo[i][pCash]); dini_Set(account, string);
format(string, sizeof(string), "Bank=%d\n", PlayerInfo[i][pAccount]); dini_Set(account, string);
format(string, sizeof(string), "Crimes=%d\n", PlayerInfo[i][pCrimes]); dini_Set(account, string);
format(string, sizeof(string), "Kills=%d\n", PlayerInfo[i][pKills]); dini_Set(account, string);
format(string, sizeof(string), "Deaths=%d\n", PlayerInfo[i][pDeaths]); dini_Set(account, string);
etc etc etc...

Reply
#92

Quote:
Originally Posted by JokeyL
Посмотреть сообщение
I don't know why, but when i save player moneys:

dini_IntSet(string, "pMoneys", GetPlayerMoney(playerid));

then value in file is -1030672120
This should be fixed after the minor change i did from a post previous to yours.

Quote:
Originally Posted by Yousha
Посмотреть сообщение
I think this should be iDini, not Dini2... because there is no API change, right?
Yea maybe, but i like dini2 a better name!

Quote:
Originally Posted by Belengher
Посмотреть сообщение
How convert this?
You don't need to convert old dini or anything. The syntax remains the same but the algorithm/source code is different.
Reply
#93

Yep, now it's working, but there is still little problem... When player statistics are saved, then in file appear unused entries, f.e;; pAchievement= or pAchievement1=0

In previously versions there was no such problem. So it has to be?
Reply
#94

Update v2.8:
- Improved code/Rewritten code
- New API available for better performance (old one is still there for conversion)
- Increased performance


@JokeyL: Test this version out and let me know the bugs.
Reply
#95

Yes! Now it's work perfect!!
Reply
#96

It makes a dof2 speed tester and dini
Reply
#97

how i can replace file name how i can?

example: User name is 'Usman' change to 'Memon'.
Reply
#98

^
PHP код:
DINI_fcopytextfile("original file""new name");
dini_Remove("original file"); 
Reply
#99

Quote:
Originally Posted by Gammix
Посмотреть сообщение
^
PHP код:
DINI_fcopytextfile("original file""new name");
dini_Remove("original file"); 
Thanks but it's not working for me i try to login the pass always wrong.
Reply

Quote:
Originally Posted by Usmanmemon
Посмотреть сообщение
Thanks but it's not working for me i try to login the pass always wrong.
Then there's most probably problem in your hashing algorithm or the way you store your hashed password with dini.

By the way, renaming file has no relevance to this?!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)