HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <hamsandwich>
  3.  
  4. #define PLUGIN "Hud Health Bar"
  5. #define VERSION "1.0"
  6. #define AUTHOR "SnoW"
  7. #define BAR_SIZE 2
  8.  
  9. new gBar[ ] = "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||";
  10.  
  11. public plugin_init( )
  12. {
  13. register_plugin( PLUGIN, VERSION, AUTHOR );
  14. register_event( "Health", "eHealth", "be" );
  15. RegisterHam( Ham_Spawn, "player", "ham_Spawn", 1 );
  16. }
  17.  
  18. public eHealth( id )
  19. show_bar( id, min( read_data( 1 ), 100 ) );
  20.  
  21. public ham_Spawn( id )
  22. {
  23. if( is_user_alive( id ) )
  24. {
  25. show_bar( id, 100 );
  26. return HAM_HANDLED;
  27. }
  28. return HAM_IGNORED;
  29. }
  30.  
  31. show_bar( id, health )
  32. {
  33. set_hudmessage( 255 - health * 2, health * 2, 0, 0.2, 0.9, 0, 6.0, 999.9, 0.0, 0.0, 3 );
  34. show_hudmessage( id, "%s", gBar[ 100 - health / BAR_SIZE ] );
  35. }
  36.