HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*==========================================================================
  2. /
  3. / [ZP] Class : Zombie Regeneration
  4. / ( Passive zombie skill )
  5. / by The_Thing
  6. /
  7. /
  8. / Description :
  9. /
  10. / This is another zombie class only this zombie are allowed to heal him self after certain time of amount he will be healing.
  11. / All can change by cvars.
  12. /
  13. /
  14. /
  15. / Cvars :
  16. /
  17. / zp_zclass_regen <1|0> - On or off, default is 1
  18. / zp_regen_time "2" - After how much seconds will be healing, default is after 2 seconds.
  19. / zp_regen_amount "25" - How much HP you will gain in healing process, default is 25 hp in 2 seconds.
  20. /
  21. /
  22. /
  23. / Credits :
  24. /
  25. / hleV - For his created plugin.
  26. /
  27. /
  28. /
  29. / Changelog :
  30. /
  31. / 06/11/2008 - v1.0 - First release
  32. /
  33. */
  34.  
  35. #include <amxmodx>
  36. #include <fakemeta>
  37. #include <zombieplague>
  38.  
  39.  
  40. new g_zclass_regen_toggle, g_time, g_amount
  41.  
  42. new const zclass8_name[] = { "Regeneralodo Zombie" }
  43. new const zclass8_info[] = { "Toltodik Visza Az Elete" }
  44. new const zclass8_model[] = { "zombie_source" }
  45. new const zclass8_clawmodel[] = { "v_knife_zombie.mdl" }
  46. const zclass8_health = 2500
  47. const zclass8_speed = 200
  48. const Float:zclass8_gravity = 1.0
  49. const Float:zclass8_knockback = 1.25
  50.  
  51. new g_zclass_Regen
  52.  
  53. public plugin_init()
  54. {
  55. g_zclass_regen_toggle = register_cvar("zp_zclass_regen", "1")
  56. g_time = register_cvar("zp_regen_time", "2")
  57. g_amount = register_cvar("zp_regen_amount", "25")
  58.  
  59. register_event("Damage", "SetRegeneration", "be", "2>0")
  60. }
  61.  
  62. public plugin_precache()
  63. {
  64. register_plugin("[ZP] Zclass : Zombie Regenerator", "1.0", "The_Thing")
  65.  
  66. g_zclass_Regen = zp_register_zombie_class(zclass8_name, zclass8_info, zclass8_model, zclass8_clawmodel, zclass8_health, zclass8_speed, zclass8_gravity, zclass8_knockback)
  67. }
  68.  
  69. public SetRegeneration(player)
  70. {
  71. if (!get_pcvar_num(g_zclass_regen_toggle) || !is_user_alive(player) || !zp_get_user_zombie(player))
  72. return PLUGIN_CONTINUE
  73.  
  74. if (zp_get_user_zombie_class(player) != g_zclass_Regen)
  75. return PLUGIN_CONTINUE
  76.  
  77. if (get_user_health(player) < zp_get_zombie_maxhealth(player))
  78. set_task(get_pcvar_float(g_time), "Regenerate", player, _, _, "b")
  79.  
  80. return PLUGIN_CONTINUE
  81. }
  82.  
  83. public Regenerate(player)
  84. {
  85. if (!get_pcvar_num(g_zclass_regen_toggle) || !is_user_alive(player) || !zp_get_user_zombie(player))
  86. return PLUGIN_CONTINUE
  87.  
  88. if (zp_get_user_zombie_class(player) != g_zclass_Regen)
  89. return PLUGIN_CONTINUE
  90.  
  91. new regen_health = get_user_health(player)
  92. new max_health = zp_get_zombie_maxhealth(player) - regen_health
  93.  
  94. if (max_health <= get_pcvar_num(g_amount))
  95. {
  96. set_pev(player, pev_health, regen_health + float(max_health))
  97. remove_task(player)
  98. }
  99.  
  100. set_pev(player, pev_health, regen_health + get_pcvar_float(g_amount))
  101.  
  102. return PLUGIN_CONTINUE
  103. }
  104.  
  105. public zp_user_infected_post(player, infector)
  106. {
  107. if (zp_get_user_zombie_class(infector) == g_zclass_Regen)
  108. {
  109. new regen_health = get_user_health(player)
  110. new max_health = zp_get_zombie_maxhealth(player) - regen_health
  111.  
  112. if (max_health <= get_pcvar_num(g_amount))
  113. {
  114. set_pev(infector, pev_health, regen_health + float(max_health))
  115. remove_task(infector)
  116.  
  117. return PLUGIN_CONTINUE
  118. }
  119.  
  120. set_pev(infector, pev_health, regen_health + get_pcvar_float(g_amount))
  121. }
  122. return PLUGIN_CONTINUE
  123. }