Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <hamsandwich>
- #include <zombieplague>
- #define PLUGIN "Hud Health Bar Fit"
- #define VERSION "1.1"
- #define AUTHOR "SnoW"
- #define BAR_SIZE 2
- #define TASK_HEALTH 1234554321
- new gBar[ ] = "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||";
- new gMaxHealth[ 33 ];
- new g_maxplay
- public plugin_init( )
- {
- register_plugin( PLUGIN, VERSION, AUTHOR );
- register_event( "Health", "eHealth", "be" );
- register_dictionary("zombie_plague.txt")
- RegisterHam( Ham_Spawn, "player", "ham_Spawn", 1 );
- RegisterHam(Ham_Killed, "player", "Fwd_PlayerKilled_Pre", 0)
- g_maxplay = get_maxplayers()
- }
- public eHealth( id )
- {
- static health, max_health;
- health = read_data( 1 );
- max_health = gMaxHealth[ id ];
- if( health > max_health )
- gMaxHealth[ id ] = max_health = health;
- show_bar( id, health * 100 / max_health );
- }
- public Fwd_PlayerKilled_Pre(victim, attacker, shouldgib)
- {
- if (task_exists(victim+TASK_HEALTH))
- remove_task(victim+TASK_HEALTH)
- }
- public ham_Spawn( id )
- {
- if( is_user_alive( id ) )
- {
- gMaxHealth[ id ] = get_user_health( id );
- show_bar( id, 100 );
- return HAM_HANDLED;
- }
- if (task_exists(id+TASK_HEALTH))
- remove_task(id+TASK_HEALTH)
- return HAM_IGNORED;
- }
- public zp_round_ended()
- {
- remove_task(id+TASK_HEALTH)
- }
- show_bar( id, health_percent )
- {
- if( zp_get_user_nemesis( id ) )
- {
- id -= TASK_HEALTH
- set_hudmessage( 215 - health_percent * 2, health_percent * 2, 0, -1.0, 0.10, 0, 6.0, 999.9, 0.0, 0.0, 3 );
- show_hudmessage( 0, "%s - %L^nРќР :^n%s", LANG_PLAYER, "CLASS_NEMESIS", gBar[ min( 99, 100 - health_percent / BAR_SIZE ) ] );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement