HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <hamsandwich>
  3. #include <zombieplague>
  4.  
  5. #define PLUGIN_NAME "Show Nemesis/Survior Hp!"
  6. #define PLUGIN_VERS "1.0"
  7. #define PLUGIN_AUTH "Dare-Devil"
  8.  
  9.  
  10. new id_survior[2]
  11. new id_nemesis[2]
  12. new hud_nsp[2]
  13. new g_maxplayers
  14.  
  15. public plugin_init()
  16. {
  17. register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH)
  18.  
  19. // Fwd's
  20. RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1)
  21. RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled_Pre", 0)
  22. register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
  23.  
  24. g_maxplayers = get_maxplayers()
  25. }
  26.  
  27. public event_round_start(id)
  28. {
  29. hud_nsp[1] = 0
  30. }
  31.  
  32. public Fwd_PlayerSpawn_Post(id)
  33. {
  34. static zp_survivors , zp_nemesis
  35.  
  36. zp_survivors = id_survior[1]
  37. zp_nemesis = id_nemesis[1]
  38.  
  39. if (zp_is_nemesis_round())
  40. {
  41. if ( zp_nemesis != 0 )
  42. {
  43.  
  44. if (id == zp_nemesis)
  45. {
  46. hud_nsp[1] = 0
  47. id_nemesis[1] = 0
  48. }
  49. }
  50. }
  51. else if (zp_is_survivor_round())
  52. {
  53. if ( zp_survivors != 0 )
  54. {
  55. if (id == zp_survivors)
  56. {
  57.  
  58. hud_nsp[1] = 0
  59. id_survior[1] = 0
  60. }
  61. }
  62. }
  63. else if (zp_is_plague_round())
  64. {
  65. if ( zp_survivors != 0 )
  66. {
  67. if (id == zp_survivors)
  68. {
  69. hud_nsp[1] = 0
  70. id_survior[1] = 0
  71. }
  72. }
  73.  
  74. if ( zp_nemesis != 0 )
  75. {
  76.  
  77. if (id == zp_nemesis)
  78. {
  79. hud_nsp[1] = 0
  80. id_nemesis[1] = 0
  81. }
  82. }
  83. }
  84. }
  85.  
  86. public Fwd_PlayerKilled_Pre(victim, attacker, shouldgib)
  87. {
  88.  
  89. static zp_survivors , zp_nemesis
  90.  
  91. zp_survivors = id_survior[1]
  92. zp_nemesis = id_nemesis[1]
  93.  
  94. if (zp_is_nemesis_round())
  95. {
  96. if ( zp_nemesis != 0 )
  97. {
  98.  
  99. if (victim == zp_nemesis)
  100. {
  101. hud_nsp[1] = 0
  102. id_nemesis[1] = 0
  103. }
  104. }
  105. }
  106. else if (zp_is_survivor_round())
  107. {
  108. if ( zp_survivors != 0 )
  109. {
  110. if (victim == zp_survivors)
  111. {
  112.  
  113. hud_nsp[1] = 0
  114. id_survior[1] = 0
  115. }
  116. }
  117. }
  118. else if (zp_is_plague_round())
  119. {
  120. if ( zp_survivors != 0 )
  121. {
  122. if (victim == zp_survivors)
  123. {
  124. hud_nsp[1] = 0
  125. id_survior[1] = 0
  126. }
  127. }
  128.  
  129. if ( zp_nemesis != 0 )
  130. {
  131.  
  132. if (victim == zp_nemesis)
  133. {
  134. hud_nsp[1] = 0
  135. id_nemesis[1] = 0
  136. }
  137. }
  138. }
  139. }
  140.  
  141. public client_disconnect(id)
  142. {
  143. static zp_survivors , zp_nemesis
  144.  
  145. zp_survivors = id_survior[1]
  146. zp_nemesis = id_nemesis[1]
  147.  
  148. if (zp_is_nemesis_round())
  149. {
  150. if ( zp_nemesis != 0 )
  151. {
  152.  
  153. if (id == zp_nemesis)
  154. {
  155. hud_nsp[1] = 0
  156. id_nemesis[1] = 0
  157. check_again_nsp(id)
  158. }
  159. }
  160. }
  161. else if (zp_is_survivor_round())
  162. {
  163. if ( zp_survivors != 0 )
  164. {
  165. if (id == zp_survivors)
  166. {
  167.  
  168. hud_nsp[1] = 0
  169. id_survior[1] = 0
  170. check_again_nsp(id)
  171. }
  172. }
  173.  
  174. }
  175. else if (zp_is_plague_round())
  176. {
  177. if ( zp_survivors != 0 )
  178. {
  179. if (id == zp_survivors)
  180. {
  181. hud_nsp[1] = 0
  182. id_survior[1] = 0
  183. check_again_nsp(id)
  184. }
  185. }
  186. if ( zp_nemesis != 0 )
  187. {
  188.  
  189. if (id == zp_nemesis)
  190. {
  191. hud_nsp[1] = 0
  192. id_nemesis[1] = 0
  193. check_again_nsp(id)
  194. }
  195. }
  196.  
  197. }
  198. }
  199.  
  200. public zp_round_started(mode, id)
  201. {
  202.  
  203. if (mode == MODE_NEMESIS)
  204. {
  205.  
  206. hud_nsp[1] = 1
  207. check_status_event_nsp(id)
  208. set_task(1.0, "hud_nsp_notice", id)
  209.  
  210. return
  211. }
  212. else if (mode == MODE_SURVIVOR)
  213. {
  214. hud_nsp[1] = 1
  215. check_status_event_nsp2(id)
  216. set_task(1.0, "hud_nsp_notice", id)
  217.  
  218. return
  219. }
  220. else if (mode == MODE_PLAGUE)
  221. {
  222. hud_nsp[1] = 1
  223. check_status_event_nsp2(id)
  224. set_task(1.0, "hud_nsp_notice", id)
  225.  
  226. return
  227. }
  228. }
  229.  
  230. public check_again_nsp(id)
  231. {
  232.  
  233. if (zp_is_nemesis_round())
  234. {
  235. hud_nsp[1] = 0
  236. check_status_event_nsp(id)
  237. set_task(1.0, "hud_nsp_notice", id)
  238. hud_nsp[1] = 1
  239. return
  240. }
  241. else if (zp_is_survivor_round())
  242. {
  243. hud_nsp[1] = 0
  244. check_status_event_nsp2(id)
  245. set_task(1.0, "hud_nsp_notice", id)
  246. hud_nsp[1] = 1
  247. return
  248. }
  249. else if (zp_is_plague_round())
  250. {
  251. hud_nsp[1] = 0
  252. check_status_event_nsp3(id)
  253. set_task(1.0, "hud_nsp_notice", id)
  254. hud_nsp[1] = 1
  255. return
  256. }
  257. }
  258.  
  259. public check_status_event_nsp(id)
  260. {
  261. static iPlayersnum
  262. iPlayersnum = ZPGetNemesis()
  263.  
  264. if(iPlayersnum == 1)
  265. {
  266. id_nemesis[1] = ZPGetRandomNemesis(random_num(1, iPlayersnum))
  267.  
  268. }
  269. }
  270.  
  271. public check_status_event_nsp2(id)
  272. {
  273. static iPlayersnum
  274. iPlayersnum = ZPGetSurvivor()
  275.  
  276. if(iPlayersnum == 1)
  277. {
  278. id_survior[1] = ZPGetRandomSurvivors(random_num(1, iPlayersnum))
  279.  
  280. }
  281. }
  282.  
  283. public check_status_event_nsp3(id)
  284. {
  285. static iPlayersnum , iPlayersnum2
  286. iPlayersnum = ZPGetSurvivor()
  287. iPlayersnum2 = ZPGetNemesis()
  288.  
  289. if(iPlayersnum == 1)
  290. {
  291. id_survior[1] = ZPGetRandomSurvivors(random_num(1, iPlayersnum))
  292. }
  293.  
  294. if(iPlayersnum2 == 1)
  295. {
  296. id_nemesis[1] = ZPGetRandomNemesis(random_num(1, iPlayersnum))
  297.  
  298. }
  299. }
  300.  
  301.  
  302. public zp_round_ended(id)
  303. {
  304. hud_nsp[1] = 0
  305. }
  306.  
  307. public hud_nsp_notice(id)
  308. {
  309. if (zp_is_nemesis_round())
  310. {
  311. static zp_nemesis
  312. zp_nemesis = id_nemesis[1]
  313.  
  314. if (hud_nsp[1] == 1 && zp_nemesis != 0)
  315. {
  316.  
  317. set_hudmessage(237, 28, 36, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
  318. show_hudmessage(0, "Nemesis Elete : %d", get_user_health(zp_nemesis))
  319. }
  320. }
  321. else if (zp_is_survivor_round())
  322. {
  323. static zp_survivors
  324. zp_survivors = id_survior[1]
  325.  
  326. if (hud_nsp[1] == 1 && zp_survivors != 0)
  327. {
  328. set_hudmessage(0, 128, 192, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
  329. show_hudmessage(0, "Tulelo Elete : %d", get_user_health(zp_survivors))
  330. }
  331. }
  332. else if (zp_is_plague_round())
  333. {
  334. static zp_survivors, zp_nemesis
  335. zp_survivors = id_survior[1]
  336. zp_nemesis = id_nemesis[1]
  337.  
  338. if (hud_nsp[1] == 1)
  339. {
  340. if (zp_survivors != 0 && zp_nemesis != 0)
  341. {
  342. if (is_user_alive(zp_survivors) && is_user_alive(zp_nemesis))
  343. {
  344. set_hudmessage(255, 128, 0, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
  345. show_hudmessage(0, "Tulelo Elete : %d - Nemesis Elete : %d", get_user_health(zp_survivors), get_user_health(zp_nemesis))
  346. }
  347. else if (is_user_alive(zp_survivors) && !is_user_alive(zp_nemesis))
  348. {
  349. set_hudmessage(255, 128, 0, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
  350. show_hudmessage(0, "Tulelo Elete : %d - Nemesis Elete : Halott", get_user_health(zp_survivors))
  351. }
  352. else if (!is_user_alive(zp_survivors) && is_user_alive(zp_nemesis))
  353. {
  354. set_hudmessage(255, 128, 0, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
  355. show_hudmessage(0, "Tulelo Elete : Halott - Nemesis Elete : %d", get_user_health(zp_nemesis))
  356. }
  357. else if (!is_user_alive(zp_survivors) && !is_user_alive(zp_nemesis))
  358. {
  359. set_hudmessage(255, 128, 0, -1.0, 0.03, 0, 1.0, 1.0, 0.1, 0.2, -1)
  360. show_hudmessage(0, "Tulelo Elete : Halott - Nemesis Élete : Halott")
  361. }
  362. }
  363. }
  364. }
  365. else // Bug fix
  366. {
  367. hud_nsp[1] = 0
  368. }
  369.  
  370. // Make it call every time when hudnsp is on
  371. if (hud_nsp[1] == 1)
  372. {
  373. set_task(1.0, "hud_nsp_notice", id)
  374. }
  375. }
  376.  
  377.  
  378. // Now get id or value (bug fix)
  379. ZPGetNemesis()
  380. {
  381. static iNemesis, id
  382. iNemesis = 0
  383.  
  384. for (id = 1; id <= g_maxplayers; id++)
  385. {
  386. if (is_user_alive(id) && zp_get_user_nemesis(id))
  387. iNemesis++
  388. }
  389.  
  390. return iNemesis;
  391. }
  392.  
  393. ZPGetSurvivor()
  394. {
  395. static iSurvivors, id
  396. iSurvivors = 0
  397.  
  398. for (id = 1; id <= g_maxplayers; id++)
  399. {
  400. if (is_user_alive(id) && zp_get_user_survivor(id))
  401. iSurvivors++
  402. }
  403.  
  404. return iSurvivors;
  405. }
  406.  
  407. ZPGetRandomNemesis(n)
  408. {
  409. static iAlive, id
  410. iAlive = 0
  411.  
  412. for (id = 1; id <= g_maxplayers; id++)
  413. {
  414. if (is_user_alive(id) && zp_get_user_nemesis(id))
  415. iAlive++
  416.  
  417. if (iAlive == n)
  418. return id;
  419. }
  420.  
  421. return -1;
  422. }
  423.  
  424. ZPGetRandomSurvivors(n)
  425. {
  426. static iAlive, id
  427. iAlive = 0
  428.  
  429. for (id = 1; id <= g_maxplayers; id++)
  430. {
  431. if (is_user_alive(id) && zp_get_user_survivor(id))
  432. iAlive++
  433.  
  434. if (iAlive == n)
  435. return id;
  436. }
  437.  
  438. return -1;
  439. }