I've done this code for a friend and I thought that it can be useful for other people.
This code adds different mp_timelimit for each map, which is good for public servers.
Code:
Spoiler
PHP Code:
#include <amxmodx> #include <amxmisc>
#define PLUGIN "Map Time" #define VERSION "1.0" #define AUTHOR "EFFx"
#define LOG_FILE "mt_log.log"
new g_iValue
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR)
if(equal(szMapName, szKey)) { if(!szValue[0]) { log_to_file(LOG_FILE, "[EFFx S]: %s's time value not found. The map will use the default value.", szKey) } else { bFound = true g_iValue = str_to_num(szValue) break } }
} fclose(iFile)
if(!bFound) { log_to_file(LOG_FILE, "[EFFx S]: The current map is not in the maps_time.ini. The map will use the default value.") } else { if(g_iValue) { set_task(2.0, "setCvarValue") } }
}
public setCvarValue() { server_cmd("mp_timelimit %d", g_iValue) }
maps_time.ini
Spoiler
; Format:
; MAPNAME = TIME IN MINUTES
; Example: de_dust2 = 55