Raised This Month: $32 Target: $400
 8% 

Help with INI...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 05-01-2006 , 15:52   Help with INI...
Reply With Quote #1

Hey guys...I am starting to make a new plugin..

What I need help with:

1.) I need plugin code to read an ini file.

2.) The value the plugin needs to read is: cvarname


After I have that there is another thing I need help with...I need to know how to make it read/write in an ini file and make admins imune to that cvar..

I am making this admin imunity plugin to let admins type /immune cvarname

SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-01-2006 , 16:02  
Reply With Quote #2

Maybe this will help: http://forums.alliedmods.net/showthr...=237434#244629
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 05-01-2006 , 16:09  
Reply With Quote #3

Not really...I kinda got lost in there...mine explaining how to get and write lines to an INI?
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-01-2006 , 16:19  
Reply With Quote #4

Here's a basic example:
Code:
#include <amxmodx> #include <amxmisc> #define MAX_GABENS 30 new filestr[84], gaben[MAX_GABENS+1][64] , g_num; public plugin_init() {     register_plugin("File reading/writing example" , "0.1" , "v3x");     register_clcmd("amx_test" , "cmd_test");     new configs_dir[64];     get_configsdir(configs_dir , 63);     format(filestr , 83 , "%s/my_file.ini" , configs_dir);     set_task(0.1 , "load_file"); } public cmd_test(id) {     if(file_exists(filestr))     {         new arg[64];         read_argv(1 , arg , 63);         if(!strlen(arg))             return PLUGIN_HANDLED;         write_file(filestr , arg , -1); // write to the end of the file (-1)     }     return PLUGIN_HANDLED; } public load_file() {     if(file_exists(filestr))     {         g_num = 0;         new text[164];         new len=0 , line=0;         while(read_file(filestr , line++ , text , 163 , len))         {             if(text[0] == ';' || !text[0]) continue;                     remove_quotes(text);                         if(g_num >= MAX_GABENS)                 return PLUGIN_HANDLED;             copy(gaben[g_num] , 63 , text); // store teh stuffs in teh var             g_num++;         }     }     else         log_amx("[AMXX] File not found: %s" , filestr);     return PLUGIN_HANDLED; }
Yay, no compile errors
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 16:58.


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