#include #include #include #define PLUGIN "MeckV Addon" #define VERSION "1.1" #define AUTHOR "Fjmaps AKA Funjob" new currentfog = 1 //Current Fog is set to 1 to make it so "Day" mode is defult. new outdoorlightstate = 0 //Sets the current state of the outdoor lights. "1" is on. //new rainboxstate = 0 //Sets state of the door that breaks the rain. //new rainboxlip = 0 new lightstate[0] = 'f' new initalconfig = 0 new currenttime new daytime = 1 public client_spawn(id) { client_print(id,print_console,"[MeckVmod] Fog is now set to %s!",currentfog) client_cmd(id,"gl_fog %s",currentfog) client_cmd(id,"r_detailtextures 1") } public client_putinserver(id) //Refreshes fog on all clients upon a client joinin { //client_print(0,print_console,"[MeckVmod] Fog is now set to %s!",currentfog) gl_refresh() if (initalconfig == 0 ) //Had some entities that needed to be used and no id. { force_use(id,find_ent_by_tname(-1,"indoorlights")) outdoorlightstate = 0 currentfog = 1 //remove_entity( find_ent_by_tname(-1,"armory_2_1") ) //remove_entity( find_ent_by_class(-1,"ts_groundweapon") ) //remove_entity( find_ent_by_tname(-1,"armory_3_1") ) //remove_entity( find_ent_by_tname(-1,"wawaclerk") ) if(get_cvar_num("amx_removefgt") == 1 ) remove_entity( find_ent_by_tname(-1,"wawaclerk") ) for(new i = 0; i < entity_count() ; i++) { if(!is_valid_ent(i)) continue new text[32] entity_get_string(i,EV_SZ_targetname,text,31) if( equali(text,"indoorsprites" ) ) { force_use(id, i) } initalconfig =1 //Make sure this doesn't get used again. } if(get_cvar_num("amx_timetype") > 0) //Used for servers that want to have this automatic { get_cvar_string("amx_startingtime",lightstate,1) new timelength = get_cvar_float("amx_timetype") set_task(timelength,"timetick",0,"",0,"b") server_print("[MeckVmod] Map timer set to %f s increments!",timelength) server_print("[MeckVmod] Automatic timer mode engaged!") } else { set_task(30.0,"gl_refresh",0,"",0,"b") //Refreshes the clients skybox/detail //server_print("[MeckVmod] Automatic timer mode disabled!") } } return PLUGIN_HANDLED } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("amx_setlights","setlights",ADMIN_IMMUNITY," - Sets the brightness of the outdoor lights, Z - Brightest"); register_clcmd("amx_togglefog","togglefog",ADMIN_IMMUNITY,"Toggles gl_fog 1/0 on clients, used for night time effect.") register_clcmd("amx_toggleoutdoorlights","toggleoutdoorlights",ADMIN_IMMUNITY,"Toggles the outdoor lights on/off") register_clcmd("amx_toggleday","toggleday",ADMIN_BAN,"<0-24> - Sets the time of the map") register_clcmd("amx_togglerain","togglerain",ADMIN_BAN,"<0-100> - Sets the ammount of the rain") register_clcmd("amx_toggleindoorlights", "toggleindoorlights", ADMIN_IMMUNITY,"Toggles the indoor lights on/off") //register_clcmd("gl_fog","refreshfog") //register_clcmd("amx_addnpc", "addnpc, ADMIN_IMMUNITY,"<1-3 ModelID>,,,") //register_clcmd("amx_togglenpcs", "togglenpc", ADMIN_IMMUNITY,"Tuns on and off the NPCs in the map") register_cvar("amx_timetype","0.0") register_cvar("amx_removefgt", "0") register_cvar("amx_startingtime","f") new currentmap[12] get_mapname(currentmap,12) if( !equali("MecklenburgV",currentmap) ) { //server_print("Mapname is: %s",currentmap) server_print("[MeckVmod] Fatal Error: The Server is not running any MecklenburgV Version!^n") server_print("[MeckVmod] Be sure the map is named 'MecklenburgV before trying to run this plugin!^n") //server_print("[MeckVmod] It's case sensitive by the way.^n") pause("d","MecklenburgV_Final.amxx") } if( equali("MecklenburgV_Final",currentmap) ) { //server_print("Mapname is: %s",currentmap) server_print("[MeckVMod] Loaded Correctly!^n") server_print("Mecklenburg V Final plugin and map made by ^nShane 'Fjmaps' Spies, AKA Shaun 'Funjob' Virgilio") server_print("Valid commands for the plugin can be found in the documentation bundled with the download^n====================") server_print("http://Fjmaps.com^n=================") server_print("MecklenburgV_Final Mode V1.0") server_cmd("exec maps/MecklenburgV_Final.cfg") } else { //server_print("Mapname is: %s",currentmap) server_print("[MeckVMod] Loaded Correctly!^n") server_print("Mecklenburg V Final plugin and map made by ^nShane 'Fjmaps' Spies, AKA Shaun 'Funjob' Virgilio") server_print("Valid commands for the plugin can be found in the documentation bundled with the download^n====================") server_print("http://Fjmaps.com^n=================") server_cmd("exec maps/MecklenburgV.cfg") } return PLUGIN_HANDLED } public timetick() { //new templightstate = str_to_num("lightstate") if (daytime == 1) { lightstate[0]++ if (equal(lightstate,"m",1)) { daytime = 0 } //server_print("[MeckVmod] Current daytime is %d",daytime) } else if (daytime == 0) { lightstate[0]-- if (equal(lightstate,"a",1)) { daytime = 2 } //server_print("[MeckVmod] Current daytime is %d",daytime) } else if(daytime >= 2 && daytime < 8) { daytime++ } else if(daytime >=8) { daytime = 1 } if (equal(lightstate,"c",1)) { server_cmd("amx_togglefog") } if (equal(lightstate,"f",1)) { server_cmd("amx_toggleoutdoorlights") } server_cmd("amx_setlights %s", lightstate[0]) server_print("[MeckVmod] Current time is now %s",lightstate[0]) gl_refresh() } //Refreshes the fog and detail textures clientside. public gl_refresh() { client_cmd(0,"gl_fog %d",currentfog) client_cmd(0,"r_detailtextures 1") //Some debugging lines //server_print("[MeckVMod] Graphical refresh has been executed on all clients") } public refreshfog(id) { client_cmd(id,"gl_fog %d",currentfog) return PLUGIN_HANDLED } //Toggles the indoor lights on and off. (The ones not connected to switches anyways.) public toggleindoorlights(id,level,cid) { if(!cmd_access(id,level,cid,1)) { return PLUGIN_HANDLED } force_use(id,find_ent_by_tname(id,"toggle_indoor_lights")) client_print(id,print_console,"[MeckVmod] The indoor lights have been toggled on/off.") return PLUGIN_HANDLED } //Turns the streetlights on and off. public toggleoutdoorlights(id,level,cid) { if(!cmd_access(id,level,cid,1)) { return PLUGIN_HANDLED } force_use(id,find_ent_by_tname(-1,"toggle_outdoor_lights")) if (outdoorlightstate == 1) //toggles the state of the lights. { outdoorlightstate = 0 client_print(id,print_console,"[MeckVmod] The street lights have been turned off.") } else { outdoorlightstate = 1 client_print(id,print_console,"[MeckVmod] The street lights have been turned on.") } return PLUGIN_HANDLED } //Toggles the door "control_rain" to stop the rain, and toggles the rain sound. public togglerain(id,level,cid) { if(!cmd_access(id,level,cid,1)) { return PLUGIN_HANDLED } force_use(id,find_ent_by_tname(-1,"control_rain")) //Set lip of rain Max of 100 force_use(id,find_ent_by_tname(-1, "rain_snd")) client_print(id, print_console,"[MeckVmod] The rain has been toggled off/on.") return PLUGIN_HANDLED } //Sets the unnamed lights in the map a certain brightness, A-Darkest public setlights(id,level,cid) { if(!cmd_access(id,level,cid,1)) { return PLUGIN_HANDLED } new arg[1] read_argv(1,arg,1) set_lights(arg) lightstate[0] = arg[0] client_print(id,print_console,"[MeckVmod] Lights are now set to %s",arg[0]) return PLUGIN_HANDLED } //Toggles the gl_fog 1/0. public togglefog(id,level,cid) { if(!cmd_access(id,level,cid,1)) { return PLUGIN_HANDLED } if ( currentfog == 0 ) { client_cmd(0,"gl_fog 1") currentfog = 1 } else { client_cmd(0,"gl_fog 0") currentfog = 0 } client_print(id,print_console,"[MeckVmod] Fog is now set to %i!",currentfog) return PLUGIN_HANDLED } //Sets the Fog, streetlights, and unnamed lights to simulate day or night. public toggleday(id,level,cid) { if(!cmd_access(id,level,cid,1)) { return PLUGIN_HANDLED } if (currenttime == 0) { currenttime = 1 //Sets the fog currentfog = 0 client_cmd(0,"gl_fog 0") client_print(id,print_console,"[MeckVmod] Fog is now set to 0.") //Sets the lights to A(off) set_lights("a") lightstate[0] = 'a' client_print(id,print_console,"[MeckVmod] Lights are now set to A.") //Sets the outdoor lights. if(outdoorlightstate == 0) { force_use(id,find_ent_by_tname(-1,"toggle_outdoor_lights")) outdoorlightstate = 1 } client_print(id,print_console,"[MeckVmod] MecklenburgV has switched to 'Nightmode'.") } else { currenttime = 0 //Sets the fog currentfog = 1 client_cmd(0,"gl_fog 1") client_print(id,print_console,"[MeckVmod] Fog is now set to 1.") //Sets the lights to Z set_lights("m") lightstate[0] = 'm' client_print(id,print_console,"[MeckVmod] Lights are now set to M.") //Sets the outdoor lights. if(outdoorlightstate == 1) { force_use(id,find_ent_by_tname(-1,"toggle_outdoor_lights")) } client_print(id,print_console,"[MeckVmod] MecklenburgV has switched to 'Daymode'.") } return PLUGIN_HANDLED } /* <23:59:43> "Kilroy Higgins" : Steven's Storage -305 -1157 -411 <23:59:49> "Kilroy Higgins" : Term's -131 -1652 -411 <23:59:58> "Kilroy Higgins" : McDonalds -202 -1569 -215 <00:00:09> "Kilroy Higgins" : MCMD1 1387 -1183 -379 <00:00:17> "Kilroy Higgins" : MCMD2 1300 -1183 -379 <00:00:36> "Kilroy Higgins" : Bar -28 -544 -411 <00:00:55> "Kilroy Higgins" : bank right 583 888 -347 <00:01:01> "Kilroy Higgins" : bank middle 484 888 -347 <00:01:08> "Kilroy Higgins" : bank left 393 888 -344 <00:01:15> "Kilroy Higgins" : vlado's -79 495 -379 <00:01:23> "Kilroy Higgins" : Cinro's -2360 1029 -403 <00:01:34> "Kilroy Higgins" : Gunshop -2473 647 -507 <00:01:47> "Kilroy Higgins" : hotel -832 -672 -395 <00:01:59> "Kilroy Higgins" : wagnaria -2368 -1218 -411 <00:02:08> "Kilroy Higgins" : Harbu sign -1053 626 507 */