Code:
/*************************************
* Daily Config Management
*
* File provided as is, no warranties!
* By: BigBaller
* First Release: April 14th, 2005
*
* This plugin allows you to set a config file for a different day on your server.
* Soo on Sunday, you could have a different server setup then Monday and ect.
* This was a redesign from a older plugin by JustinHoMi, which was later ported to AMX MOD X
* by Burnzy.
*
*
* File names *ARE* case sensitive. Soo you must have the first letter in each day as a capital letter!!!
* Examples:
* Sun.cfg
* Mon.cfg
* Tue.cfg
* Wed.cfg
* Thu.cfg
* Fri.cfg
* Sat.cfg
*
* All these config files are placed in the amxmodx/configs/daily_cfgs/ directory.
*
* In the config files, just place the CVARs you want ran in that day. What is great about this plugin is
* you are still able to use a custom map config for a specific map and not conflict!
* Soo in the Sat.cfg (saturday config) if I had sv_alltalk 1 then if the map fy_iceworld came up and I have
* fy_iceworld in my amxmodx/configs/maps/ with sv_alltalk 0. Then sv_alltalk will be set to 0. Thus this allows
* you to have global CVARs while still being able to set certain CVARs on specific maps!!!
*
* Also, since plugins are checked every map change, this plugin makes sure your mapchangecfgfile is server.cfg OR the config
* used for that day. Especially good for you lazy admins such as myself :D.
*
* Now I know this will work for Counter-Strike/Condition Zero, however I am unsure of DoD/NS and other mods.
*
* Change Log:
* v1.0, Initial Release
*************************************/
#include <amxmodx>
#include <amxmisc>
public plugin_init(){
register_plugin("Daily Config Management", "1.0", "BigBaller")
new today[8], configPath[256]
new todayFile[] = {"Sun.cfg","Mon.cfg","Tue.cfg","Wed.cfg","Thu.cfg","Fri.cfg","Sat.cfg"}
new serverCfg[] = "server.cfg" // change server.cfg if you do not want to use server.cfg as your default server config file!
get_time("%a", today, 8)
get_configsdir(configPath, 255)
format(todayFile, 255, "%s/daily_cfgs/%s.cfg", configPath, today)
if (file_exists(todayFile)){
set_cvar_string("mapchangecfgfile", todayFile) // Set today's server config file.
// log_amx("The file %s was loaded because it was found.", todayFile) // For Debugging purposes!
return PLUGIN_CONTINUE
}
set_cvar_string("mapchangecfgfile", serverCfg) // If there is no config file for today, it makes sure you are using the server.cfg file!
// log_amx("The file we are looking for does not exsist therefore doing the intended effect. File loaded is %s", serverCfg) // For Debugging purposes!
return PLUGIN_CONTINUE
}
And I know putting everything in the plugin_init() isnt exactly effecient,
HOWEVER it works and it works like it was designed to work.
I dont think I will add much more to this but I think other admins might find this extremely useful. I plan on using it to allow matrix mod to run on my server on Friday's only