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

Need Help for Config


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kriax
Senior Member
Join Date: Apr 2012
Old 02-21-2014 , 12:13   Need Help for Config
Reply With Quote #1

Hello,

I made ​​a self-balancing via a config file based on the map.
I only want to know how to finish the plugin because I block, let me explain:

In addons / sourcemod / config I have a folder name test, this test file name includes the name of each map used by the server.
If the file does not exist, the plugin automatically created.

Files that behaves like this:

Code:
"team"
{
    "1"        "1"
    "3"        "6"
    "4"        "11"
    "5"        "16"
    "6"        "24"
    "7"        "30"
    
    // "T"    "CT"
}
I want to know how to read my addons/sourcemod/test/de_dust2.cfg file.
And how an automatic swap T in CT if the number of T is greater to that defined in the config.

This is the beginning of the plugin:

PHP Code:
#include <sourcemod>

new String:g_sConfigFile[256];

public 
OnMapStart()
{
    
decl String:sPath[256];
    
BuildPath(Path_SMsPathsizeof(sPath), "configs/test");
    
    if (!
DirExists(sPath))
        
CreateDirectory(sPath511);
        
    
decl String:sMap[64];
    
GetCurrentMap(sMapsizeof(sMap));
    
    
BuildPath(Path_SMg_sConfigFilesizeof(g_sConfigFile), "configs/test/%s.cfg"sMap);
    
    if (!
FileExists(g_ConfigFilefalse))
        
CreateConfig();
}

public 
CreateConfig()
{
    new 
Handle:hKv CreateKeyValues("team""""");
    
FileToKeyValues(hKvg_sConfigFile);
    
    
KvSetNum(hKv"1"1);
    
KvSetNum(hKv"2"6);
    
KvSetNum(hKv"3"11);
    
KvSetNum(hKv"4"16);
    
KvSetNum(hKv"5"24);
    
    
KeyValuesToFile(hKvg_ConfigFile);
    
CloseHandle(hKv);

Thx,
Kriax.

Spoiler

Last edited by Kriax; 02-21-2014 at 12:14.
Kriax is offline
Kriax
Senior Member
Join Date: Apr 2012
Old 03-04-2014 , 13:46   Re: Need Help for Config
Reply With Quote #2

up
Kriax 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 10:43.


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