HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*================================================================================
  2.  
  3. ---------------------------------
  4. -*- [ZP] Low HP Heartbeat 1.1 -*-
  5. ---------------------------------
  6.  
  7. ~~~~~~~~~~~~~~~
  8. - Description -
  9. ~~~~~~~~~~~~~~~
  10.  
  11. This plugin plays a heartbeat sound on humans when their health
  12. is under certain amount.
  13.  
  14. ~~~~~~~~~
  15. - CVARS -
  16. ~~~~~~~~~
  17.  
  18. * zp_heartbeat_hp <50> - Heartbeats start when HP is lower than this
  19.  
  20. ~~~~~~~~~~~~~~
  21. - Credits to -
  22. ~~~~~~~~~~~~~~
  23.  
  24. * ConnorMcLeod, AlexBreems: for the original plugin
  25.  
  26. ================================================================================*/
  27.  
  28. #include <amxmodx>
  29. #include <zombieplague>
  30.  
  31. /*================================================================================
  32.  [Plugin Customization]
  33. =================================================================================*/
  34.  
  35. // Sounds
  36. new const g_heartbeat[] = "player/heartbeat1.wav"
  37.  
  38. /*============================================================================*/
  39.  
  40. new cvar_heartbeathp
  41.  
  42. public plugin_precache()
  43. {
  44. precache_sound(g_heartbeat)
  45. }
  46.  
  47. public plugin_init()
  48. {
  49. register_plugin("[ZP] Low HP Heartbeat", "1.1", "ConnorMcLeod/MeRcyLeZZ")
  50.  
  51. register_event("Damage", "event_damage", "be", "2>0")
  52. register_event("DeathMsg", "event_deathmsg", "a")
  53. register_event("ResetHUD", "event_resethud", "be")
  54. register_event("Spectator", "event_spectator", "a")
  55.  
  56. cvar_heartbeathp = register_cvar("zp_heartbeat_hp", "50")
  57. }
  58.  
  59. public event_damage(id)
  60. {
  61. if (get_user_health(id) > get_pcvar_num(cvar_heartbeathp) || zp_get_user_zombie(id))
  62. return;
  63.  
  64. // * Replaced with emit_sound so players near us can hear it too *
  65. //client_cmd(id, "spk %s", g_heartbeat)
  66. //emit_sound(id, CHAN_STATIC, g_heartbeat, 0.0, 0.0, SND_STOP, PITCH_NORM)
  67.  
  68. emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, 0, PITCH_NORM)
  69. }
  70.  
  71. public event_deathmsg()
  72. {
  73. emit_sound(read_data(2), CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
  74. }
  75.  
  76. public event_resethud(id)
  77. {
  78. emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
  79. }
  80.  
  81. public event_spectator()
  82. {
  83. emit_sound(read_data(1), CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
  84. }
  85.  
  86. public zp_user_infected_post(id, infector)
  87. {
  88. emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
  89. }
  90.