HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. * http://games.qwerty.ru
  3. *
  4. * AmxModX
  5. * Vampire plugin
  6. * by Shalfey
  7. *
  8. * CVars
  9. * amx_vampire_hp - hp add for kill
  10. * amx_vampire_hp_hs - hp add for kill in head
  11. * amx_vampire_max_hp - max player hp
  12. *
  13. * Players gets HP for kills.
  14. */
  15. #include <amxmodx>
  16. #include <fun>
  17.  
  18. #define PLUGIN_VERSION "1.0c"
  19.  
  20. new health_add
  21. new health_hs_add
  22. new health_max
  23.  
  24. new nKiller
  25. new nKiller_hp
  26. new nHp_add
  27. new nHp_max
  28.  
  29. public plugin_init()
  30. {
  31. register_plugin("Vampire", PLUGIN_VERSION, "Shalfey")
  32.  
  33. health_add = register_cvar("amx_vampire_hp", "15")
  34. health_hs_add = register_cvar("amx_vampire_hp_hs", "40")
  35. health_max = register_cvar("amx_vampire_max_hp", "100")
  36.  
  37. register_event("DeathMsg", "hook_death", "a", "1>0")
  38. }
  39.  
  40. public hook_death()
  41. {
  42. // Killer id
  43. nKiller = read_data(1)
  44.  
  45. if ( (read_data(3) == 1) && (read_data(5) == 0) )
  46. {
  47. nHp_add = get_pcvar_num (health_hs_add)
  48. }
  49. else
  50. nHp_add = get_pcvar_num (health_add)
  51.  
  52. nHp_max = get_pcvar_num (health_max)
  53.  
  54. // Updating Killer HP
  55. nKiller_hp = get_user_health(nKiller)
  56. nKiller_hp += nHp_add
  57.  
  58. // Maximum HP check
  59. if (nKiller_hp > nHp_max) nKiller_hp = nHp_max
  60.  
  61. set_user_health(nKiller, nKiller_hp)
  62.  
  63. // Hud message "Gyogyulsz +15/+40 hp"
  64. set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
  65. show_hudmessage(nKiller, "Gyogyulsz +%d hp", nHp_add)
  66.  
  67. // Screen fading
  68. message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0,0,0}, nKiller)
  69. write_short(1<<10)
  70. write_short(1<<10)
  71. write_short(0x0000)
  72. write_byte(0)
  73. write_byte(0)
  74. write_byte(200)
  75. write_byte(75)
  76. message_end()
  77.  
  78. }
  79.