MecklenburgV_Final.sma 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4. #define PLUGIN "MeckV Addon"
  5. #define VERSION "1.1"
  6. #define AUTHOR "Fjmaps AKA Funjob"
  7. new currentfog = 1 //Current Fog is set to 1 to make it so "Day" mode is defult.
  8. new outdoorlightstate = 0 //Sets the current state of the outdoor lights. "1" is on.
  9. //new rainboxstate = 0 //Sets state of the door that breaks the rain.
  10. //new rainboxlip = 0
  11. new lightstate[0] = 'f'
  12. new initalconfig = 0
  13. new currenttime
  14. new daytime = 1
  15. public client_spawn(id)
  16. {
  17. client_print(id,print_console,"[MeckVmod] Fog is now set to %s!",currentfog)
  18. client_cmd(id,"gl_fog %s",currentfog)
  19. client_cmd(id,"r_detailtextures 1")
  20. }
  21. public client_putinserver(id) //Refreshes fog on all clients upon a client joinin
  22. {
  23. //client_print(0,print_console,"[MeckVmod] Fog is now set to %s!",currentfog)
  24. gl_refresh()
  25. if (initalconfig == 0 ) //Had some entities that needed to be used and no id.
  26. {
  27. force_use(id,find_ent_by_tname(-1,"indoorlights"))
  28. outdoorlightstate = 0
  29. currentfog = 1
  30. //remove_entity( find_ent_by_tname(-1,"armory_2_1") )
  31. //remove_entity( find_ent_by_class(-1,"ts_groundweapon") )
  32. //remove_entity( find_ent_by_tname(-1,"armory_3_1") )
  33. //remove_entity( find_ent_by_tname(-1,"wawaclerk") )
  34. if(get_cvar_num("amx_removefgt") == 1 ) remove_entity( find_ent_by_tname(-1,"wawaclerk") )
  35. for(new i = 0; i < entity_count() ; i++)
  36. {
  37. if(!is_valid_ent(i)) continue
  38. new text[32]
  39. entity_get_string(i,EV_SZ_targetname,text,31)
  40. if( equali(text,"indoorsprites" ) )
  41. {
  42. force_use(id, i)
  43. }
  44. initalconfig =1 //Make sure this doesn't get used again.
  45. }
  46. if(get_cvar_num("amx_timetype") > 0) //Used for servers that want to have this automatic
  47. {
  48. get_cvar_string("amx_startingtime",lightstate,1)
  49. new timelength = get_cvar_float("amx_timetype")
  50. set_task(timelength,"timetick",0,"",0,"b")
  51. server_print("[MeckVmod] Map timer set to %f s increments!",timelength)
  52. server_print("[MeckVmod] Automatic timer mode engaged!")
  53. }
  54. else
  55. {
  56. set_task(30.0,"gl_refresh",0,"",0,"b") //Refreshes the clients skybox/detail
  57. //server_print("[MeckVmod] Automatic timer mode disabled!")
  58. }
  59. }
  60. return PLUGIN_HANDLED
  61. }
  62. public plugin_init() {
  63. register_plugin(PLUGIN, VERSION, AUTHOR)
  64. register_clcmd("amx_setlights","setlights",ADMIN_IMMUNITY,"<a-z> - Sets the brightness of the outdoor lights, Z - Brightest");
  65. register_clcmd("amx_togglefog","togglefog",ADMIN_IMMUNITY,"Toggles gl_fog 1/0 on clients, used for night time effect.")
  66. register_clcmd("amx_toggleoutdoorlights","toggleoutdoorlights",ADMIN_IMMUNITY,"Toggles the outdoor lights on/off")
  67. register_clcmd("amx_toggleday","toggleday",ADMIN_BAN,"<0-24> - Sets the time of the map")
  68. register_clcmd("amx_togglerain","togglerain",ADMIN_BAN,"<0-100> - Sets the ammount of the rain")
  69. register_clcmd("amx_toggleindoorlights", "toggleindoorlights", ADMIN_IMMUNITY,"Toggles the indoor lights on/off")
  70. //register_clcmd("gl_fog","refreshfog")
  71. //register_clcmd("amx_addnpc", "addnpc, ADMIN_IMMUNITY,"<1-3 ModelID>,<x>,<y>,<z>")
  72. //register_clcmd("amx_togglenpcs", "togglenpc", ADMIN_IMMUNITY,"Tuns on and off the NPCs in the map")
  73. register_cvar("amx_timetype","0.0")
  74. register_cvar("amx_removefgt", "0")
  75. register_cvar("amx_startingtime","f")
  76. new currentmap[12]
  77. get_mapname(currentmap,12)
  78. if( !equali("MecklenburgV",currentmap) )
  79. {
  80. //server_print("Mapname is: %s",currentmap)
  81. server_print("[MeckVmod] Fatal Error: The Server is not running any MecklenburgV Version!^n")
  82. server_print("[MeckVmod] Be sure the map is named 'MecklenburgV before trying to run this plugin!^n")
  83. //server_print("[MeckVmod] It's case sensitive by the way.^n")
  84. pause("d","MecklenburgV_Final.amxx")
  85. }
  86. if( equali("MecklenburgV_Final",currentmap) )
  87. {
  88. //server_print("Mapname is: %s",currentmap)
  89. server_print("[MeckVMod] Loaded Correctly!^n")
  90. server_print("Mecklenburg V Final plugin and map made by ^nShane 'Fjmaps' Spies, AKA Shaun 'Funjob' Virgilio")
  91. server_print("Valid commands for the plugin can be found in the documentation bundled with the download^n====================")
  92. server_print("http://Fjmaps.com^n=================")
  93. server_print("MecklenburgV_Final Mode V1.0")
  94. server_cmd("exec maps/MecklenburgV_Final.cfg")
  95. }
  96. else
  97. {
  98. //server_print("Mapname is: %s",currentmap)
  99. server_print("[MeckVMod] Loaded Correctly!^n")
  100. server_print("Mecklenburg V Final plugin and map made by ^nShane 'Fjmaps' Spies, AKA Shaun 'Funjob' Virgilio")
  101. server_print("Valid commands for the plugin can be found in the documentation bundled with the download^n====================")
  102. server_print("http://Fjmaps.com^n=================")
  103. server_cmd("exec maps/MecklenburgV.cfg")
  104. }
  105. return PLUGIN_HANDLED
  106. }
  107. public timetick()
  108. {
  109. //new templightstate = str_to_num("lightstate")
  110. if (daytime == 1)
  111. {
  112. lightstate[0]++
  113. if (equal(lightstate,"m",1))
  114. {
  115. daytime = 0
  116. }
  117. //server_print("[MeckVmod] Current daytime is %d",daytime)
  118. }
  119. else if (daytime == 0)
  120. {
  121. lightstate[0]--
  122. if (equal(lightstate,"a",1))
  123. {
  124. daytime = 2
  125. }
  126. //server_print("[MeckVmod] Current daytime is %d",daytime)
  127. }
  128. else if(daytime >= 2 && daytime < 8)
  129. {
  130. daytime++
  131. }
  132. else if(daytime >=8)
  133. {
  134. daytime = 1
  135. }
  136. if (equal(lightstate,"c",1))
  137. {
  138. server_cmd("amx_togglefog")
  139. }
  140. if (equal(lightstate,"f",1))
  141. {
  142. server_cmd("amx_toggleoutdoorlights")
  143. }
  144. server_cmd("amx_setlights %s", lightstate[0])
  145. server_print("[MeckVmod] Current time is now %s",lightstate[0])
  146. gl_refresh()
  147. }
  148. //Refreshes the fog and detail textures clientside.
  149. public gl_refresh()
  150. {
  151. client_cmd(0,"gl_fog %d",currentfog)
  152. client_cmd(0,"r_detailtextures 1")
  153. //Some debugging lines
  154. //server_print("[MeckVMod] Graphical refresh has been executed on all clients")
  155. }
  156. public refreshfog(id)
  157. {
  158. client_cmd(id,"gl_fog %d",currentfog)
  159. return PLUGIN_HANDLED
  160. }
  161. //Toggles the indoor lights on and off. (The ones not connected to switches anyways.)
  162. public toggleindoorlights(id,level,cid)
  163. {
  164. if(!cmd_access(id,level,cid,1))
  165. {
  166. return PLUGIN_HANDLED
  167. }
  168. force_use(id,find_ent_by_tname(id,"toggle_indoor_lights"))
  169. client_print(id,print_console,"[MeckVmod] The indoor lights have been toggled on/off.")
  170. return PLUGIN_HANDLED
  171. }
  172. //Turns the streetlights on and off.
  173. public toggleoutdoorlights(id,level,cid)
  174. {
  175. if(!cmd_access(id,level,cid,1))
  176. {
  177. return PLUGIN_HANDLED
  178. }
  179. force_use(id,find_ent_by_tname(-1,"toggle_outdoor_lights"))
  180. if (outdoorlightstate == 1) //toggles the state of the lights.
  181. {
  182. outdoorlightstate = 0
  183. client_print(id,print_console,"[MeckVmod] The street lights have been turned off.")
  184. }
  185. else
  186. {
  187. outdoorlightstate = 1
  188. client_print(id,print_console,"[MeckVmod] The street lights have been turned on.")
  189. }
  190. return PLUGIN_HANDLED
  191. }
  192. //Toggles the door "control_rain" to stop the rain, and toggles the rain sound.
  193. public togglerain(id,level,cid)
  194. {
  195. if(!cmd_access(id,level,cid,1))
  196. {
  197. return PLUGIN_HANDLED
  198. }
  199. force_use(id,find_ent_by_tname(-1,"control_rain")) //Set lip of rain Max of 100
  200. force_use(id,find_ent_by_tname(-1, "rain_snd"))
  201. client_print(id, print_console,"[MeckVmod] The rain has been toggled off/on.")
  202. return PLUGIN_HANDLED
  203. }
  204. //Sets the unnamed lights in the map a certain brightness, A-Darkest
  205. public setlights(id,level,cid)
  206. {
  207. if(!cmd_access(id,level,cid,1))
  208. {
  209. return PLUGIN_HANDLED
  210. }
  211. new arg[1]
  212. read_argv(1,arg,1)
  213. set_lights(arg)
  214. lightstate[0] = arg[0]
  215. client_print(id,print_console,"[MeckVmod] Lights are now set to %s",arg[0])
  216. return PLUGIN_HANDLED
  217. }
  218. //Toggles the gl_fog 1/0.
  219. public togglefog(id,level,cid)
  220. {
  221. if(!cmd_access(id,level,cid,1))
  222. {
  223. return PLUGIN_HANDLED
  224. }
  225. if ( currentfog == 0 )
  226. {
  227. client_cmd(0,"gl_fog 1")
  228. currentfog = 1
  229. }
  230. else
  231. {
  232. client_cmd(0,"gl_fog 0")
  233. currentfog = 0
  234. }
  235. client_print(id,print_console,"[MeckVmod] Fog is now set to %i!",currentfog)
  236. return PLUGIN_HANDLED
  237. }
  238. //Sets the Fog, streetlights, and unnamed lights to simulate day or night.
  239. public toggleday(id,level,cid)
  240. {
  241. if(!cmd_access(id,level,cid,1))
  242. {
  243. return PLUGIN_HANDLED
  244. }
  245. if (currenttime == 0)
  246. {
  247. currenttime = 1
  248. //Sets the fog
  249. currentfog = 0
  250. client_cmd(0,"gl_fog 0")
  251. client_print(id,print_console,"[MeckVmod] Fog is now set to 0.")
  252. //Sets the lights to A(off)
  253. set_lights("a")
  254. lightstate[0] = 'a'
  255. client_print(id,print_console,"[MeckVmod] Lights are now set to A.")
  256. //Sets the outdoor lights.
  257. if(outdoorlightstate == 0)
  258. {
  259. force_use(id,find_ent_by_tname(-1,"toggle_outdoor_lights"))
  260. outdoorlightstate = 1
  261. }
  262. client_print(id,print_console,"[MeckVmod] MecklenburgV has switched to 'Nightmode'.")
  263. }
  264. else
  265. {
  266. currenttime = 0
  267. //Sets the fog
  268. currentfog = 1
  269. client_cmd(0,"gl_fog 1")
  270. client_print(id,print_console,"[MeckVmod] Fog is now set to 1.")
  271. //Sets the lights to Z
  272. set_lights("m")
  273. lightstate[0] = 'm'
  274. client_print(id,print_console,"[MeckVmod] Lights are now set to M.")
  275. //Sets the outdoor lights.
  276. if(outdoorlightstate == 1)
  277. {
  278. force_use(id,find_ent_by_tname(-1,"toggle_outdoor_lights"))
  279. }
  280. client_print(id,print_console,"[MeckVmod] MecklenburgV has switched to 'Daymode'.")
  281. }
  282. return PLUGIN_HANDLED
  283. }
  284. /*
  285. <23:59:43> "Kilroy Higgins"
  286. : Steven's Storage -305 -1157 -411
  287. <23:59:49> "Kilroy Higgins"
  288. : Term's -131 -1652 -411
  289. <23:59:58> "Kilroy Higgins"
  290. : McDonalds -202 -1569 -215
  291. <00:00:09> "Kilroy Higgins"
  292. : MCMD1 1387 -1183 -379
  293. <00:00:17> "Kilroy Higgins"
  294. : MCMD2 1300 -1183 -379
  295. <00:00:36> "Kilroy Higgins"
  296. : Bar -28 -544 -411
  297. <00:00:55> "Kilroy Higgins"
  298. : bank right 583 888 -347
  299. <00:01:01> "Kilroy Higgins"
  300. : bank middle 484 888 -347
  301. <00:01:08> "Kilroy Higgins"
  302. : bank left 393 888 -344
  303. <00:01:15> "Kilroy Higgins"
  304. : vlado's -79 495 -379
  305. <00:01:23> "Kilroy Higgins"
  306. : Cinro's -2360 1029 -403
  307. <00:01:34> "Kilroy Higgins"
  308. : Gunshop -2473 647 -507
  309. <00:01:47> "Kilroy Higgins"
  310. : hotel -832 -672 -395
  311. <00:01:59> "Kilroy Higgins"
  312. : wagnaria -2368 -1218 -411
  313. <00:02:08> "Kilroy Higgins"
  314. : Harbu sign -1053 626 507
  315. */