Simple configuration loading method, credit to Bara.
Example usage:
Code:
void OnPluginStart(){
char file[PLATFORM_MAX_PATH];
BuildPath(Path_SM, file, sizeof(file), "configs/mysettings.cfg");
if(Config_Setup("Server-Settings", file)){
bool mybool = Config_LoadBool("mybool", true, "Default bool description");
int myint = Config_LoadInt("myint", 0, "Default int description");
float myfloat = Config_LoadFloat("myfloat", 0.0, "Default float description");
char buffer[128];
Config_LoadString("mystring", "default string description", "Default string description", buffer, sizeof(buffer));
Config_Done();
}
}
This example was updated 2/25/2016 to reflect the change made on the repository on 1/12/2016.
This has been available for some time and is seen in use in the Trouble in Terrorist Town plugin; I am just now posting it here in the hopes more people will find use in it.
GitHub:
https://github.com/whocodes/config-loader
__________________