HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*================================================================================
  2.  
  3. ---------------------------------
  4. -*- [ZP] Extra Item : T-Virus -*-
  5. ---------------------------------
  6.  
  7. -----------------
  8. - Description -
  9. -----------------
  10.  
  11. This plugin adds an extra item to zombie plague advance mode, it's called T-Virus.
  12. It turns every human who buys it to a zombie.
  13.  
  14.  
  15. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  16. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  17.  
  18.  
  19. -------------
  20. *||CVARS||*
  21. -------------
  22. - T-Virus 1
  23. Set this to 0 will disable the plugin, 1 means to enable it .
  24.  
  25. - T-Nemesis 0
  26. Set this to 0 will disable T-Virus during Nemesis round , 1 means to enable it .
  27.  
  28. - T-Swarm 0
  29. Set this to 0 will disable T-Virus during Swarm round , 1 means to enable it.
  30.  
  31. - T-Plague 0
  32. Set this to 0 will disable T-Virus during Plague round , 1 means to enable it.
  33.  
  34. - T-Assassin 0
  35. Set this to 0 will disable T-Virus during Assassin round , 1 means to enable it.
  36.  
  37. - T-Allow_Virus_Before_Infection_Spread 0
  38. Set this to 0 means that no one can buy the T-Virus before any GameMode starts , 1 means that players can buy the T-Virus even before the infection spread ( not recommended )
  39. ( Note : if you want to set this to 1 i suggest to increase the price of the T-Virus, any way it's up to you .)
  40. .
  41. - T-Sound 1
  42. Set this to 0 means to disable the T-Virus sound when you buy it, 1 means that you will hear the T-Virus sound .
  43. Notes : 1- if you want to change the sound just edit the lines number : 95, 96 and make your owns, they will be triggred randomly .
  44. 2- if you want to make only one sound just make the tow lines (95, 96) the same it means give the .wav files the same name .
  45. 3- T-Sound is heard from everywhere it means every player on the server can hear it .
  46.  
  47. ***** VERY IMPORTANT NOTE : IF YOU WANT TO CHANGE THE T-VIRUS COST PLEASE EDIT THE LINE NUMBER 87 AND EDIT ALSO IN THE
  48. zpa_extraitems.ini FILE *****
  49.  
  50. """"""""""""""""""""""""""""" onother note : This plugin works only in ZPA """"""""""""""""""""""""""""""""
  51.  
  52.  
  53.  
  54. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  56.  
  57.  
  58.  
  59. ---------------
  60. *||CREDITS||*
  61. ---------------
  62. abdul-rehman =====> His TUT (how to create custom mode) helped me on how to declare sounds and call them .and of course for his zpa mode.
  63.  
  64.  
  65. jc980 =====> T-Virus Sound
  66.  
  67.  
  68. MeRcyLeZZ =====> Original Zombie Plague mode
  69.  
  70.  
  71.  
  72. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  73. HAVE FUN ...
  74. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  75. :
  76.  
  77. ================================================================================*/
  78.  
  79. #include <amxmodx>
  80. #include <zombie_plague_advance>
  81.  
  82.  
  83. // Item IDs
  84. new g_t_virus, g_t_nemesis, g_t_swarm, g_t_plague, g_t_assassin, g_t_before, g_t_sound
  85. new g_virus
  86. // T-Virus Cost : if you want to change the price of the T-Virus please edit here and edit in the zpa_extraitems.ini also .
  87. new const item_cost = 15
  88. // T-Virus Name
  89. new const item_name[] = "T-Virus"
  90. // players name
  91. new name[32]
  92. // T-Virus Sound : if you want to change the T-Virus Sound just edit here .
  93. new const g_play_sounds[][] =
  94. {
  95. "zombie_plague/T-Virus.wav" ,
  96. "zombie_plague/T-Virus2.wav"
  97. }
  98.  
  99. public plugin_precache ( )
  100. {
  101. new i
  102. for (i = 0; i < sizeof g_play_sounds; i++)
  103. precache_sound( g_play_sounds[i] )
  104. }
  105.  
  106. public plugin_init()
  107. {
  108. register_plugin("[ZP] Extra Item : T-Virus", "1.0", "A.Madjid")
  109.  
  110. // Register the new items and store their IDs for future reference
  111. g_virus = zp_register_extra_item(item_name, item_cost, ZP_TEAM_HUMAN) // Humans only
  112. g_t_virus = register_cvar("T-Virus", "1") // on/off the pluing .
  113. g_t_nemesis = register_cvar("T-Nemesis", "0") // enable or desable T-Virus in nemesis mode .
  114. g_t_swarm = register_cvar("T-Swarm", "0") // in sawrm mode .
  115. g_t_plague = register_cvar("T-plague", "0") // in plague mode .
  116. g_t_assassin = register_cvar("T-Assassin", "0") // in assassin mode .
  117. g_t_before = register_cvar("T-Allow_Virus_Before_Infection_Spread", "0") // Allow T-Virus before infection starts .
  118. g_t_sound = register_cvar("T-Sound", "0" ) // T-Virus sound .
  119.  
  120.  
  121. }
  122.  
  123. // Item Selected forward
  124. public zp_extra_item_selected(player, itemid)
  125. {
  126. //some vars
  127. new count_human = zp_get_human_count()
  128. new count_zombie = zp_get_zombie_count()
  129. new mode = zp_get_current_mode()
  130. new ammo = zp_get_user_ammo_packs(player)
  131. get_user_name(player, name, 31)
  132.  
  133. // Check if the selected item matches any of our registered ones
  134. if ( (get_pcvar_num(g_t_virus) == 1) && (itemid == g_virus) )
  135. {
  136. if ( (count_human > 1) && (count_zombie > 0) )
  137. {
  138. if (mode == MODE_NEMESIS )
  139. {
  140. if ( get_pcvar_num(g_t_nemesis ) == 1 )
  141. {
  142. if (get_pcvar_num(g_t_sound) == 1 )
  143. {
  144. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  145. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  146. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  147. zp_infect_user (player, 0, 1, 0)
  148. client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
  149. }
  150. else if (get_pcvar_num(g_t_sound) == 0 )
  151. {
  152. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  153. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  154. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  155. zp_infect_user (player, 0, 1, 0)
  156. }
  157. }
  158. else if ( get_pcvar_num(g_t_nemesis ) == 0 )
  159. {
  160. zp_set_user_ammo_packs(player,ammo + item_cost)
  161. client_print(player, print_chat, "[ZP] A T-Virus le van tiltva ebben a modba!")
  162. }
  163. return;
  164. }
  165. if (mode == MODE_SWARM )
  166. {
  167. if (get_pcvar_num(g_t_swarm) == 1 )
  168. {
  169. if (get_pcvar_num(g_t_sound) == 1 )
  170. {
  171. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  172. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  173. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  174. zp_infect_user (player, 0, 1, 0)
  175. client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
  176. }
  177. else if (get_pcvar_num(g_t_sound) == 0 )
  178. {
  179. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  180. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  181. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  182. zp_infect_user (player, 0, 1, 0)
  183. }
  184. }
  185. else if (get_pcvar_num(g_t_swarm) == 0 )
  186. {
  187. zp_set_user_ammo_packs(player,ammo + item_cost)
  188. client_print(player, print_chat, "[ZP] A T-Virus le van tiltva ebben a modba!")
  189. }
  190. return;
  191. }
  192. if (mode == MODE_PLAGUE )
  193. {
  194. if (get_pcvar_num(g_t_plague) == 1)
  195. {
  196. if (get_pcvar_num(g_t_sound) == 1 )
  197. {
  198. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  199. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  200. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  201. zp_infect_user (player, 0, 1, 0)
  202. client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
  203. }
  204. else if (get_pcvar_num(g_t_sound) == 0 )
  205. {
  206. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  207. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  208. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  209. zp_infect_user (player, 0, 1, 0)
  210. }
  211. }
  212. else if (get_pcvar_num(g_t_plague) == 0)
  213. {
  214. zp_set_user_ammo_packs(player,ammo + item_cost)
  215. client_print(player, print_chat, "[ZP] A T-Virus le van tiltva ebben a modba!")
  216. }
  217. return;
  218. }
  219. if (mode == MODE_ASSASSIN)
  220. {
  221. if (get_pcvar_num(g_t_assassin) == 1)
  222. {
  223. if (get_pcvar_num(g_t_sound) == 1 )
  224. {
  225. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  226. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  227. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  228. zp_infect_user (player, 0, 1, 0)
  229. client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
  230. }
  231. else if (get_pcvar_num(g_t_sound) == 0 )
  232. {
  233. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  234. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  235. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  236. zp_infect_user (player, 0, 1, 0)
  237. }
  238. }
  239. else if (get_pcvar_num(g_t_assassin) == 0)
  240. {
  241. zp_set_user_ammo_packs(player, ammo + item_cost)
  242. client_print(player, print_chat, "[ZP] A T-Virus le van tiltva ebben a modba!")
  243. }
  244. return;
  245. }
  246. else
  247. {
  248. if (get_pcvar_num(g_t_sound) == 1 )
  249. {
  250. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  251. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  252. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  253. zp_infect_user (player, 0, 1, 0)
  254. client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
  255. }
  256. else if (get_pcvar_num(g_t_sound) == 0 )
  257. {
  258. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  259. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  260. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  261. zp_infect_user (player, 0, 1, 0)
  262. }
  263. }
  264. }
  265. else if ( count_human == 1 )
  266. {
  267. zp_set_user_ammo_packs(player, ammo + item_cost)
  268. client_print(player, print_chat, "[ZP] Nem lehet megvasarolni a T-virus, mert te vagy az utolso ember!")
  269. }
  270. else if ( (!count_zombie ) && (get_pcvar_num(g_t_before) == 1) )
  271. {
  272. if (get_pcvar_num(g_t_sound) == 1 )
  273. {
  274. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  275. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  276. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  277. zp_infect_user (player, 0, 1, 0)
  278. client_cmd(0, "spk ^"%s^"", g_play_sounds[ random_num(0, sizeof g_play_sounds -1) ] )
  279. }
  280. else if (get_pcvar_num(g_t_sound) == 0 )
  281. {
  282. set_hudmessage(0, 200, 0, -0.95, 0.5, 1, 0.0, 10.0, 1.0, 1.0, -1)
  283. show_hudmessage(0, "%s megfertozve a T-Virus altal!", name)
  284. client_print(player, print_chat, "[ZP] Te megvasaroltad a T-Virus!")
  285. zp_infect_user (player, 0, 1, 0)
  286. }
  287. }
  288. else if ( (!count_zombie ) && (get_pcvar_num(g_t_before) == 0) )
  289. {
  290. zp_set_user_ammo_packs(player, ammo + item_cost)
  291. client_print(player, print_chat, "[ZP] Nem lehet megvasarolni a T-virust, mielott barmilyen jatek mod el nem indul!")
  292. }
  293. }
  294.  
  295. else
  296. {
  297. zp_set_user_ammo_packs(player, ammo + item_cost)
  298. }
  299. }