Raised This Month: $51 Target: $400
 12% 

Inline Config API


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands        Approver:   Arkshine (91)
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 12-14-2011 , 10:18   Inline Config API
Reply With Quote #1

Sometimes there is a need to configure compiled plugin, but cvars and custom *.ini and *.cfg files seems redundant and annoying.

This very simple plugin allows to pass some args to any plugins just inside plugins.ini. It scans /amxmodx/configs dir for plugins.ini and plugins-*.ini, and then scans these files for embedded configs (see syntax below). Per-map configs aren't yet supported.

Embedding syntax:
Quote:
plugin-name.amxx debug-etc endline
[;@arg body endline]
[;@arg body endline]
[;@arg body endline]
...
Embedding example:
Quote:
myplugin.amxx
;@abchmu

my_extra_item.amxx
;@name Wunderwaffe
;@cost 12000

my_stats.amxx
;@host myhost.net
;@db cs_stats
;@user cs_stats
;@pass 123456
How to read:
Code:
public plugin_init() {     ...     read_inline_config()     ... } read_inline_config() {     new num_records = InlineConfig_NumRecords()     new record_data[100]     for(new record = 1; record <= num_records; record++)     {         InlineConfig_GetRecord(record, record_data, charsmax(record_data))         ...     } }

Comments on one line with args won't be recognized, thus args may inclue ';' and '//'.
Quote:
myplugin.amxx
;@http://www.amxmodx.org/
;@one;two;three;
No comment lines allowed between plugin and its args. Comments after plugin name are still allowed.
Quote:
good_plugin.amxx debug // this plugin rocks
;@this arg will pass

bad_plugin.amxx
;yay!
;@this arg won't pass

;disabled_plugin.amxx // here is a reason for such rule
;@this arg won't pass
Attached Files
File Type: zip InlineConfig.zip (7.7 KB, 328 views)
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|

Last edited by Shadows In Rain; 03-28-2012 at 17:58.
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
r14170
Veteran Member
Join Date: Dec 2009
Old 12-14-2011 , 13:05   Re: Inline Config API
Reply With Quote #2

Cool!
r14170 is offline
Korxu
Senior Member
Join Date: Sep 2010
Old 12-14-2011 , 13:30   Re: Inline Config API
Reply With Quote #3

You have to remove '.amxx' file from the '.zip' and add the plugin separated.

Last edited by Korxu; 12-14-2011 at 13:31.
Korxu is offline
Shadows In Rain
Senior Member
Join Date: Apr 2010
Location: Russia::Siberia
Old 12-14-2011 , 13:48   Re: Inline Config API
Reply With Quote #4

@Korxu,
Arkshine allowed me to post compiled stuff.
__________________
I'm using Google translator, yarrr. |.◕‿‿◕.|

Last edited by Shadows In Rain; 12-14-2011 at 13:54.
Shadows In Rain is offline
Send a message via ICQ to Shadows In Rain
Old 01-17-2012, 04:54
reko_o
This message has been deleted by xPaw. Reason: Flooding "thanks" posts
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-30-2012 , 05:48   Re: Inline Config API
Reply With Quote #5

Approved.
__________________
Arkshine is offline
Reply



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 19:10.


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