SimpleIni

Started by Ankris, Aug 30, 2016, 04:08 PM

Previous topic - Next topic

Kewun

its some sh!t like   IniFile <- INI_Open("test.ini")

then

INI_SetInteger(IniFile, other, some, params)

Mötley

wut.. I thought it was called simple Ini.. lol?!?

Kewun

yeah thats the sh!tty thing in it

Mötley

But I will say It's different. Seems like fun. Intended to fully use this plug-in and release a example.

If Ankris doesn't beat me to it or some other

I do not know about some as I feel it's really not needed but, Like INI_Exists, INI_SaveFile, But I will use it anyway I guess

KAKAN

A OO style would be better. Then, we would use it something like:-
local INIFile = INI("filename");
print(INIFile.ReadRaw())
INIFile.Get(...);
That'd be better I guess :)
Quote from: Mötley on Oct 09, 2016, 06:51 PMwut.. I thought it was called simple Ini.. lol?!?
he saves the shits to your RAM, that means, everything is stored in that INI pointer, so, that's a good way to do it.
oh no

Mötley

I find it best to use a global variable and assign an initial value

# I have  not assigned  a true system yet

This is a junk script for figuring out how it works
Accounts_Ini <- INI_Open("Accounts.ini");
IPs__Ini <- INI_Open("IP_List.ini");
Subnets__Ini <- INI_Open("Subnet_List.ini");
UniqueID__Ini <- INI_Open("UniqueID_List.ini");

function SaveIniFiles() {
INI_SaveFile( Accounts_Ini, "Accounts.ini");
INI_SaveFile( IPs__Ini, "IP_List.ini");
INI_SaveFile( Subnets__Ini, "Subnet_List.ini");
INI_SaveFile( UniqueID__Ini, "UniqueID_List.ini");
}

function onPlayerJoin( player )
{
local ip = player.IP.tostring();
local sliceip = split( ip, "." );
local ip1 = sliceip[ 0 ], ip2 = sliceip[ 1 ];
local subnet = format( ip1 + "." + ip2 );

Pstats[ player.ID ] = PlayerStats();
INI_SetInteger( Accounts_Ini, player.Name, "Joins", Pstats[ player.ID ].Joins);
INI_SetString( IPs__Ini, "IP", player.Name, player.IP);

INI_SetString( Subnets__Ini, "Subnet", player.Name, subnet);

INI_SetString( UniqueID__Ini, "UID", player.Name, player.UniqueID2);

SaveIniFiles();

}


jWeb

#21
I know we're going off topic here and the posts will most likely get removed, but I had to highlight this portion of code:
Quote from: Mötley on Oct 10, 2016, 11:41 PM local ip = player.IP.tostring();
local sliceip = split( ip, "." );
local ip1 = sliceip[ 0 ], ip2 = sliceip[ 1 ];
local subnet = format( ip1 + "." + ip2 );

player.IP is already a string. What's the point of format()?  What's the point of creating `ip1` and `ip2` variables? Actually, I don't even wanna know.

Mötley

Those are subnet ips. They will come in handy later on in the server

Thijn

Quote from: Mötley on Oct 11, 2016, 12:07 AMThose are subnet ips. They will come in handy later on in the server
What he means is, you can rewrite that piece of code to
local sliceip = split( player.IP, "." );
local subnet = sliceip[0] + "." + sliceip[1];

Mötley

LOL!!!!
http://forum.liberty-unleashed.co.uk/index.php/topic,1037.0.html

Thank you both of you. When I read Thijn Code my mind said WTF!!
xD ;D
Thank you ;)