Raised This Month: $7 Target: $400
 1% 

INI File Reader/Writer AMXX 1.9


Post New Thread Reply   
 
Thread Tools Display Modes
E1_531G
Senior Member
Join Date: Dec 2017
Old 05-28-2019 , 01:11   Re: INI File Reader/Writer AMXX 1.9
Reply With Quote #11

Hello again.
I think this API misses one very good thing: natives for keeping file open for some time, for multiple-writings/readings.
You can see similar feature in SQLVault: https://forums.alliedmods.net/showthread.php?t=146849

For example:
1. I know i have to read 3 settings keys from the file
2. I use: ini_init( ... )
3. I use 3 times: ini_read_int( ... )
4. I use ini_end( ... )

How it works?
ini_init() creates a global temporary file pointer.
if ini_read_int or others natives see what that global pointer is available they use it instead of opening and closing the file again and again.
ini_end() kills that global pointer.

Maybe it is not a big deal speaking about performance, but think a bit, when you use an API like this one you almost always know which keys you have to read and how many they are.
__________________
My English is A0

Last edited by E1_531G; 05-28-2019 at 01:13.
E1_531G is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-28-2019 , 14:32   Re: INI File Reader/Writer AMXX 1.9
Reply With Quote #12

Not a bad idea, I'll update it when I've time.
__________________








CrazY. is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 11-30-2019 , 20:52   Re: INI File Reader/Writer AMXX 1.9
Reply With Quote #13

hey, how i see this include doesnt have option to delete section (by steamid for example)...
@CrazY. can you add that one?

because if we use only writing data to file, time of loading will be slower by time, so having option to reduce 'old rows' will really help us

PS: is 'ini_read_string' even working? im getting arguments error, with this simple example: ini_read_string(FILENAME, szAuthId, "Name", g_szName[ id ] );
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...) - not active (dec 2022)

Last edited by JocAnis; 11-30-2019 at 21:14.
JocAnis is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 12-04-2019 , 10:03   Re: INI File Reader/Writer AMXX 1.9
Reply With Quote #14

I don't have much free time now, anyway I didn't added a option to remove sections because the main purpose of this include is work with settings. There are many vault systems already to work with player data and such things.
__________________








CrazY. is offline
karaulov
Senior Member
Join Date: Jul 2018
Old 08-07-2022 , 08:02   Re: INI File Reader/Writer AMXX 1.9
Reply With Quote #15

How to remove warnings from <ini_file>

// C:\Projects\amxmodx\scripting\RERUNEMOD\rm_si lentstep_item.sma(380) : warning 203: symbol is never used: "_ini_copyc"
// C:\Projects\amxmodx\scripting\RERUNEMOD\rm_si lentstep_item.sma(55) : warning 203: symbol is never used: "_ini_read"
// C:\Projects\amxmodx\scripting\RERUNEMOD\rm_si lentstep_item.sma(79) : warning 203: symbol is never used: "_ini_write"



Missing stock prefixes

Last edited by karaulov; 08-07-2022 at 08:05.
karaulov is offline
karaulov
Senior Member
Join Date: Jul 2018
Old 08-07-2022 , 09:05   Re: INI File Reader/Writer AMXX 1.9
Reply With Quote #16

Quote:
Originally Posted by CrazY. View Post
I don't have much free time now, anyway I didn't added a option to remove sections because the main purpose of this include is work with settings. There are many vault systems already to work with player data and such things.
code from example
Code:
new const FILENAME[] = "sql.ini";
    new const SECTION[] = "SQL";

    if (!ini_read_string(FILENAME, SECTION, "Host", SQL_HOST, charsmax(SQL_HOST)))
        ini_write_string(FILENAME, SECTION, "Host", SQL_HOST);
create sql.ini.ini file, instead of sql.ini
karaulov is offline
asdian
Member
Join Date: Sep 2016
Location: Indonesia
Old 03-24-2023 , 03:46   Re: INI File Reader/Writer AMXX 1.9
Reply With Quote #17

will this works with around 120 sections? i'm having difficulties with amx_settings_api which is looks like reached its limit
asdian is offline
Reply


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

Forum Jump


All times are GMT -4. The time now is 04:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode