HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* =========================================
  2. 1. Description
  3. - When you get infect, you will get a calculated health by number of players and number of zombies
  4. - I hope this plugin will make your zombie server balanced about health
  5. --- I saw much server unbalance... 32 player, 2 zombie but zombie health: 2000 -> Quick Death
  6.  
  7. 2. Calculation
  8. - Health = (Total Player / Total Zombie) * 1000
  9.  
  10. Example 1: In your server had Total 20 player and 5 zombies
  11. => Health = (20 / 5) * 1000
  12. <=> Health = 4000HP
  13.  
  14. Example 2: In your server had Total 32 player and 10 zombies
  15. => Health = (32 / 10) * 1000
  16. <=> Health = 3200HP
  17.  
  18. Example 3: In your server had Total 32 player and 2 zombies
  19. => Health = (32 / 2) * 1000
  20. <=> Health = 16000HP (Just lile first zombie )
  21.  
  22. 3. Cvar
  23. - zp_auto_health 1 // Default: 1
  24.  
  25. 4. Credits
  26. - fengxy | His idea
  27. - Dias | Make this plug
  28. ========================================= */
  29.  
  30. #include <amxmodx>
  31. #include <fun>
  32. #include <zombieplague>
  33.  
  34. #define PLUGIN "[ZP] Addon: Auto Health"
  35. #define VERSION "1.1"
  36. #define AUTHOR "Dias"
  37.  
  38. new cvar_auto_health, cvar_stock_health
  39. new g_maxplayers
  40.  
  41. public plugin_init()
  42. {
  43. register_plugin(PLUGIN, VERSION, AUTHOR)
  44.  
  45. g_maxplayers = get_maxplayers()
  46.  
  47. cvar_auto_health = register_cvar("zp_auto_health", "1")
  48. cvar_stock_health = register_cvar("zp_stock_health", "1000")
  49. }
  50.  
  51. public zp_user_infected_post(id)
  52. {
  53. // Nemesis? no need la
  54. if(zp_get_user_nemesis(id)) return;
  55.  
  56. if(get_pcvar_num(cvar_auto_health))
  57. {
  58. new health
  59. health = (get_player_count() / get_zombie_count()) * get_pcvar_num(cvar_stock_health)
  60. set_user_health(id, health)
  61. }
  62. }
  63.  
  64. get_zombie_count()
  65. {
  66. new count
  67. for(new i = 0; i < g_maxplayers; i++)
  68. {
  69. if(is_user_connected(i) && zp_get_user_zombie(i))
  70. count++
  71. }
  72.  
  73. return count
  74. }
  75.  
  76. get_player_count()
  77. {
  78. new count
  79. for(new i = 0; i < g_maxplayers; i++)
  80. {
  81. if(is_user_connected(i))
  82. count++
  83. }
  84.  
  85. return count
  86. }
  87. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  88. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
  89. */
  90.