AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   About Link Up the .ini Files to Plugins (https://forums.alliedmods.net/showthread.php?t=312078)

Jess98 11-15-2018 08:56

About Link Up the .ini Files to Plugins
 
I want to learn how to link up the .ini files to plugins.. I had looked a lot of plugins which have a connect with .ini files, but didn't get the logic as well.

Is there any in-line explanation or example that explains this process?

instinctpt1 11-15-2018 11:30

Re: About Link Up the .ini Files to Plugins
 
Example1: https://forums.alliedmods.net/showthread.php?t=152802
Tutorial : https://forums.alliedmods.net/showthread.php?t=46218

Kushfield 11-15-2018 11:36

Re: About Link Up the .ini Files to Plugins
 
There's now a function called AutoExecConfig in AMXX, which should take care of all the logic itself.
http://www.amxmodx.org/api/amxmodx/AutoExecConfig

OciXCrom 11-17-2018 14:49

Re: About Link Up the .ini Files to Plugins
 
Quote:

Originally Posted by Kushfield (Post 2624174)
There's now a function called AutoExecConfig in AMXX, which should take care of all the logic itself.
http://www.amxmodx.org/api/amxmodx/AutoExecConfig

That's for .cfg files. For .ini files there's a built-in INI Parser, but I prefer a custom made reading system.
You can have a look at my plugins that use .ini files for a working example.

Jess98 11-23-2018 06:33

Re: About Link Up the .ini Files to Plugins
 
I understood a little bit but can anyone make a simple example?

OciXCrom 11-23-2018 07:42

Re: About Link Up the .ini Files to Plugins
 
Try to do it yourself and post what you have done and explain what the problem is.

DarthMan 11-24-2018 04:51

Re: About Link Up the .ini Files to Plugins
 
Quote:

Originally Posted by OciXCrom (Post 2624496)
That's for .cfg files. For .ini files there's a built-in INI Parser, but I prefer a custom made reading system.
You can have a look at my plugins that use .ini files for a working example.

The SMC Parser (if that's what you're talking about) is not that easy to understand especially for newbies it might be very hard. Also, there are absolutely no tutorials on how to use it and haven't seen a plug-in using the SMC. There's 1 on SourceMod, and that's the admin plug-in. Other than than, I guess, on SM, ppl use KeyValues. So there's not rly much about learning SMC, just looking on the testinclude folder and trying to understand yourself how it works.

Jess98 11-24-2018 07:29

Re: About Link Up the .ini Files to Plugins
 
For a little example, I want to make a mapchooser. How can I read and administer datas in the .ini file that I use in my plugin? And please, explain without hard Amx Mod X phrases. I can't get everything 'cuz I'm a newbie.

This is my start code:

Code:

#include <amxmodx>

new const MAP_FILE[] = "maps.ini" // Creating the .ini file

public plugin_init() {

      register_plugin("Example", "1.0", "No One")       
}


Ghosted 11-24-2018 08:43

Re: About Link Up the .ini Files to Plugins
 
Code:

ReadFile(PathToFile[])
{
new File = fopen(PathToFile, "rt");
new Buffer[128], A[128], B[128];
while (!feof(File))
{
fgets(File, Buffer, charsmax(Buffer));

if (!Buffer[0] || Buffer[0] == '#')
continue;

remove_quotes(Buffer);
strtok(Buffer, A, charsmax(A), B, charsmax(B), '=');
trim(A);
trim(B);

//A=Key
//B=Value
}

fclose(File);
}

/not tested/
/i have not implemented sections, i think that is too much for simple ini files/

CrazY. 11-25-2018 05:55

Re: About Link Up the .ini Files to Plugins
 
amx_settings_api


All times are GMT -4. The time now is 11:52.

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