/* ** author: Buddha-Pest (buddha@beatdown12.com) ** ** this script will change the map to lure_map ** whenever there are not enough players ** on the server ** */ #include <core> #include <console> #include <string> #include <admin> #include <adminlib> /* ** change the following 2 variables to your liking ** ** userThresholdAtEnd - this many users or less at end of map ** and we go to popular map ** userThresholdAnyTime - if we ever fall to this number or less ** we go to popular map immediately */ /* add 1 to the two following if you have HLTV */ new userThresholdAtEnd = 4; new userThresholdAnyTime = 0; new lureMap[100]; new currentMap[100]; new STRING_VERSION[MAX_DATA_LENGTH] = "2.0"; public CheckThreshold(Timer,Repeat,HLUser,Param) { if(playercount() <= userThresholdAnyTime) { if(strcmp(lureMap,currentMap) && valid_map(lureMap)) { changeToLureMap(); } } else if(timeleft(0) <= 60 && playercount() <= userThresholdAtEnd) { if(valid_map(lureMap)) { changeToLureMap(); } } } changeToLureMap() { new Text[MAX_TEXT_LENGTH]; snprintf(Text,MAX_TEXT_LENGTH,"Switching map to %s to lure more players.",lureMap); say(Text); changelevel(lureMap,4); } public admin_lure_map(HLCommand,HLData,HLUserName,UserIndex) { new Data[100]; convert_string(HLData,Data,100); strstripquotes(Data); if(valid_map(Data)) { strcpy(lureMap,Data,100); set_vaultdata("LURE_MAP",Data); } else { selfmessage("Invalid map:"); selfmessage(Data); } return PLUGIN_HANDLED; } public plugin_init() { plugin_registerinfo("Plugin Lure", "Switches to a popular map to lure players.",STRING_VERSION); plugin_registercmd("admin_lure_map","admin_lure_map",ACCESS_RCON,"admin_lure_map <map>: Set the map to change to when playercount is low."); if(get_vaultdata("LURE_MAP",lureMap,100) == 0) { strcpy(lureMap,"de_dust",100); set_vaultdata("LURE_MAP",lureMap); } currentmap(currentMap,100); set_timer("CheckThreshold",60,99999); return PLUGIN_CONTINUE; }