Raised This Month: $ Target: $400
 0% 

[Help] Load Config File With Variables


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
exec0d3
Member
Join Date: Apr 2009
Location: Georgia
Old 06-10-2009 , 05:51   [Help] Load Config File With Variables
Reply With Quote #1

Hi all
I whant to load .cfg file with configurations for my plugin ...
And I whant to load it from ... addons\New Folder\config.cfg ...

Please, write example plugin for me

Thanks for attention
exec0d3 is offline
Send a message via Skype™ to exec0d3
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-10-2009 , 06:00   Re: [Help] Load Config File With Variables
Reply With Quote #2

There are a lot of plugins which do that. Start to search before, it will be more faster for you.
__________________
Arkshine is offline
exec0d3
Member
Join Date: Apr 2009
Location: Georgia
Old 06-10-2009 , 06:04   Re: [Help] Load Config File With Variables
Reply With Quote #3

For example, which?
exec0d3 is offline
Send a message via Skype™ to exec0d3
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-10-2009 , 07:00   Re: [Help] Load Config File With Variables
Reply With Quote #4

Code:
#include <amxmodx>   new ExecFilePath[] = "addons/New Folder/config.cfg";   public plugin_init()         server_cmd("exec ^"%s", ExecFilePath);
__________________
hleV is offline
exec0d3
Member
Join Date: Apr 2009
Location: Georgia
Old 06-10-2009 , 07:52   Re: [Help] Load Config File With Variables
Reply With Quote #5

Thanks, but how to get variables?
like this:
PHP Code:
new MyVar
 
public plugin_init(){
MyVar register_cvar("amx_FFFF","yes")

exec0d3 is offline
Send a message via Skype™ to exec0d3
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-10-2009 , 08:44   Re: [Help] Load Config File With Variables
Reply With Quote #6

Code:
#include <amxmodx>   // In that file should be writen the CVar ant its value, like "amx_ffff 1" new ExecFilePath[] = "addons/New Folder/config.cfg";   new MyVar;   public plugin_init() {         MyVar = register_cvar("amx_ffff", "1"); // 1 - on, 0 - off           server_cmd("exec ^"%s^"", ExecFilePath); }   public SomeFunc() {         if (get_pcvar_num(MyVar))         {                 // Do stuff if MyVar is enabled         }         else         {                 // Do stuff if MyVar is disabled         } }
__________________

Last edited by hleV; 06-10-2009 at 08:46.
hleV is offline
exec0d3
Member
Join Date: Apr 2009
Location: Georgia
Old 06-10-2009 , 11:17   Re: [Help] Load Config File With Variables
Reply With Quote #7

Thanks
exec0d3 is offline
Send a message via Skype™ to exec0d3
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 13:48.


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