Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <hamsandwich>
  3. #include <zombieplague>
  4.  
  5. #define PLUGIN "Hud Health Bar Fit"
  6. #define VERSION "1.1"
  7. #define AUTHOR "SnoW"
  8. #define BAR_SIZE 2
  9. #define TASK_HEALTH 1234554321
  10.  
  11. new gBar[ ] = "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||";
  12. new gMaxHealth[ 33 ];
  13.  
  14. new g_maxplay
  15.  
  16. public plugin_init( )
  17. {
  18. register_plugin( PLUGIN, VERSION, AUTHOR );
  19. register_event( "Health", "eHealth", "be" );
  20. register_dictionary("zombie_plague.txt")
  21. RegisterHam( Ham_Spawn, "player", "ham_Spawn", 1 );
  22. RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled_Pre", 0)
  23. g_maxplay = get_maxplayers()
  24.  
  25. }
  26.  
  27. public eHealth( id )
  28. {
  29. static health, max_health;
  30. health = read_data( 1 );
  31. max_health = gMaxHealth[ id ];
  32. if( health > max_health )
  33. gMaxHealth[ id ] = max_health = health;
  34. show_bar( id, health * 100 / max_health );
  35. }
  36. public Fwd_PlayerKilled_Pre(victim, attacker, shouldgib)
  37. {
  38. if (task_exists(victim+TASK_HEALTH))
  39. remove_task(victim+TASK_HEALTH)
  40. }
  41. public ham_Spawn( id )
  42. {
  43. if( is_user_alive( id ) )
  44. {
  45. gMaxHealth[ id ] = get_user_health( id );
  46. show_bar( id, 100 );
  47. return HAM_HANDLED;
  48. }
  49. if (task_exists(id+TASK_HEALTH))
  50. remove_task(id+TASK_HEALTH)
  51.  
  52. return HAM_IGNORED;
  53. }
  54. public zp_round_ended()
  55. {
  56. remove_task(id+TASK_HEALTH)
  57. }
  58. show_bar( id, health_percent )
  59. {
  60. if( zp_get_user_nemesis( id ) )
  61. {
  62. id -= TASK_HEALTH
  63. set_hudmessage( 215 - health_percent * 2, health_percent * 2, 0, -1.0, 0.10, 0, 6.0, 999.9, 0.0, 0.0, 3 );
  64. show_hudmessage( 0, "%s - %L^nРќР :^n%s", LANG_PLAYER, "CLASS_NEMESIS", gBar[ min( 99, 100 - health_percent / BAR_SIZE ) ] );
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement