Plugin Available ZE ZOMBIE HEALTH BAR

Unpaid Requests, Public Plugins
Post Reply
sammy6369
Member
Member
Hong Kong
Posts: 7
Joined: 2 Years Ago
Has thanked: 0
Been thanked: 0
Contact:

ZE ZOMBIE HEALTH BAR

#1

Post by sammy6369 » 2 Years Ago

I would like to have a more advanced version.
The less health, the color turns from green to red.
Something like that.
Also, a longer and larger health bar sprite.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#2

Post by johnnysins2000 » 2 Years Ago

Oo I think U mean Like zp has health bar?

Well I will make it for You If u want
Nobody Is That Busy If They Make Time :roll:

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#3

Post by johnnysins2000 » 2 Years Ago

  1. #include <zombie_escape>
  2.  
  3. #define PLUGIN "[ZE] Addon: Show Health Bar"
  4. #define VERSION "1.0"
  5. #define AUTHOR "ZE DEV TEAM"
  6.  
  7. new const healthbar_spr[] = "sprites/zb_healthbar.spr"
  8. new g_playerbar[33] , g_isAlive[33]
  9. new g_playerMaxHealth[33]
  10.  
  11. public plugin_init()
  12. {
  13.     register_plugin(PLUGIN, VERSION, AUTHOR)
  14.    
  15.     RegisterHam(Ham_Spawn, "player", "ham_spawn_post", 1)
  16.     register_forward(FM_AddToFullPack, "fm_addtofullpack_post", 1)
  17.    
  18.     register_event("ResetHUD", "event_resethud", "be")
  19.     register_event("DeathMsg", "event_death", "a")
  20.     register_event("Health", "event_health", "be")
  21.    
  22.     make_healthbar()
  23. }
  24.  
  25. public make_healthbar()
  26. {
  27.     static playerBar, allocString
  28.     allocString = engfunc(EngFunc_AllocString, "env_sprite")
  29.    
  30.     for( new id = 1; id <= get_maxplayers(); id ++ )
  31.     {
  32.         g_playerbar[id] = engfunc(EngFunc_CreateNamedEntity, allocString)
  33.         playerBar = g_playerbar[id]
  34.        
  35.         if(pev_valid(playerBar))
  36.         {
  37.             set_pev(playerBar, pev_scale, 0.25)
  38.             engfunc(EngFunc_SetModel, playerBar, healthbar_spr)
  39.             set_pev(playerBar, pev_effects, pev(playerBar, pev_effects ) | EF_NODRAW)
  40.         }
  41.     }  
  42. }
  43.  
  44. public plugin_precache() engfunc(EngFunc_PrecacheModel, healthbar_spr)
  45.  
  46. public ham_spawn_post(id)
  47. {
  48.     if(is_user_alive(id))
  49.     {
  50.         g_isAlive[id] = 1
  51.     }
  52. }
  53.  
  54. public  ze_user_infected(id)
  55. {
  56.     g_playerMaxHealth[id] = get_user_health(id)
  57. }
  58.  
  59. public ze_user_humanized(id)
  60. {
  61.     set_pev(g_playerbar[id], pev_effects, pev(g_playerbar[id], pev_effects) | EF_NODRAW)
  62. }
  63.  
  64. public client_disconnect(id)
  65. {
  66.     set_pev(g_playerbar[id], pev_effects, pev(g_playerbar[id], pev_effects) | EF_NODRAW)
  67. }
  68.  
  69. public event_resethud(id)
  70. {
  71.     set_pev(g_playerbar[id], pev_effects, pev(g_playerbar[id], pev_effects) | EF_NODRAW)
  72. }
  73.  
  74. public event_death()
  75. {
  76.     new id = read_data(2)
  77.    
  78.     g_isAlive[id] = 0
  79.     set_pev(g_playerbar[id], pev_effects, pev(g_playerbar[id], pev_effects) | EF_NODRAW)
  80. }
  81.  
  82. public event_health(id)
  83. {
  84.     new hp = get_user_health(id)
  85.    
  86.     if(g_playerMaxHealth[id] < hp)
  87.     {
  88.         g_playerMaxHealth[id] = hp
  89.         set_pev(g_playerbar[id], pev_frame, 99.0)
  90.     }
  91.     else
  92.     {
  93.         set_pev(g_playerbar[id], pev_frame, 0.0 + (((hp - 1) * 100) / g_playerMaxHealth[id]))
  94.     }
  95. }
  96.  
  97. public fm_addtofullpack_post(es, e, user, host, host_flags, player, p_set)
  98. {
  99.     if(!player)
  100.         return FMRES_IGNORED
  101.        
  102.     if(!is_user_alive(host) || !is_user_alive(user))
  103.         return FMRES_IGNORED
  104.        
  105.     if(!ze_is_user_zombie(user))
  106.         return FMRES_IGNORED
  107.        
  108.     if(host == user)
  109.         return FMRES_IGNORED
  110.    
  111.     new Float:PlayerOrigin[3]
  112.     pev(user, pev_origin, PlayerOrigin)
  113.                            
  114.     PlayerOrigin[2] += 60.0
  115.                        
  116.     engfunc(EngFunc_SetOrigin, g_playerbar[user], PlayerOrigin)
  117.     set_pev(g_playerbar[user], pev_effects, pev(g_playerbar[user], pev_effects) & ~EF_NODRAW)
  118.  
  119.     return FMRES_HANDLED
  120. }
here try this

sprite u can download from here

http://www.mediafire.com/file/1naee37b0 ... th+Bar.rar
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#4

Post by Raheem » 2 Years Ago

Johnny, Upload the file direct to our forum better (It's not so big to upload to external platform).
You don't know? Learn and you will know.

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#5

Post by johnnysins2000 » 2 Years Ago

Raheem wrote:
2 Years Ago
Johnny, Upload the file direct to our forum better (It's not so big to upload to external platform).
How about Posting the full Plugin ?
Nobody Is That Busy If They Make Time :roll:

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1962
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 21
Contact:

#6

Post by Raheem » 2 Years Ago

Will be good idea if you posted it.
You don't know? Learn and you will know.

sammy6369
Member
Member
Hong Kong
Posts: 7
Joined: 2 Years Ago
Has thanked: 0
Been thanked: 0
Contact:

#7

Post by sammy6369 » 2 Years Ago

johnnysins2000 wrote:
2 Years Ago
Oo I think U mean Like zp has health bar?

Well I will make it for You If u want
Cool. That's what I mean. Thank you.
May be some cvars like zb/human display, who can see and something else...
The most important part is the sprite and it will change color as the health. :D

johnnysins2000
Veteran Member
Veteran Member
Pakistan
Posts: 672
Joined: 2 Years Ago
Location: Lahore
Has thanked: 11 times
Been thanked: 10 times
Age: 22
Contact:

#8

Post by johnnysins2000 » 2 Years Ago

Mark it as solved and locked

plugin is available here

viewtopic.php?f=15&t=1927&p=3392#p3392
Nobody Is That Busy If They Make Time :roll:

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests