Raised This Month: $ Target: $400
 0% 

Bar health


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
felipemilralze
Senior Member
Join Date: Jul 2011
Location: Brazil
Old 03-10-2017 , 16:05   Bar health
Reply With Quote #1

Help me by this health bar just for nemesis, survivor, sniper, zombie plague 5.0.

Because I do not understand what this does "FM_AddToFullPack"

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zp50_core>

#define PLUGIN "[ZP] Addon: Show Zombie Health"
#define VERSION "1.0"
#define AUTHOR "Dias : BlackCat (bug fix)"

new const healthbar_spr[] = "sprites/zb_healthbar.spr"
new g_playerbar[33] , g_isAlive[33]
new 
g_playerMaxHealth[33]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""ham_spawn_post"1)
    
register_forward(FM_AddToFullPack"fm_addtofullpack_post"1)
    
    
register_event("ResetHUD""event_resethud""be")
    
register_event("DeathMsg""event_death""a")
    
register_event("Health""event_health""be")
    
    
make_healthbar()
}

public 
make_healthbar()
{
    static 
playerBarallocString
    allocString 
engfunc(EngFunc_AllocString"env_sprite")
    
    for( new 
id 1id <= get_maxplayers(); id ++ )
    {
        
g_playerbar[id] = engfunc(EngFunc_CreateNamedEntityallocString)
        
playerBar g_playerbar[id]
        
        if(
pev_valid(playerBar))
        {
            
set_pev(playerBarpev_scale0.25)
            
engfunc(EngFunc_SetModelplayerBarhealthbar_spr)
            
set_pev(playerBarpev_effectspev(playerBarpev_effects ) | EF_NODRAW)
        }
    }    
}

public 
plugin_precache() engfunc(EngFunc_PrecacheModelhealthbar_spr)

public 
ham_spawn_post(id)
{
    if(
is_user_alive(id))
    {
        
g_isAlive[id] = 1
    
}
}

public 
zp_fw_core_infect_post(id)
{
    
g_playerMaxHealth[id] = get_user_health(id)
}

public 
zp_fw_core_cure_post(id)
{
    
set_pev(g_playerbar[id], pev_effectspev(g_playerbar[id], pev_effects) | EF_NODRAW)
}

public 
client_disconnect(id
{
    
set_pev(g_playerbar[id], pev_effectspev(g_playerbar[id], pev_effects) | EF_NODRAW)
}

public 
event_resethud(id)
{
    
set_pev(g_playerbar[id], pev_effectspev(g_playerbar[id], pev_effects) | EF_NODRAW)
}

public 
event_death()
{
    new 
id read_data(2)
    
    
g_isAlive[id] = 0
    set_pev
(g_playerbar[id], pev_effectspev(g_playerbar[id], pev_effects) | EF_NODRAW)
}

public 
event_health(id)
{
    new 
hp get_user_health(id)
    
    if(
g_playerMaxHealth[id] < hp)
    {
        
g_playerMaxHealth[id] = hp
        set_pev
(g_playerbar[id], pev_frame99.0)
    }

    else
    {
        
set_pev(g_playerbar[id], pev_frame0.0 + (((hp 1) * 100) / g_playerMaxHealth[id]))
    }
}

public 
fm_addtofullpack_post(eseuserhosthost_flagsplayerp_set)
{
    if(!
player)
        return 
FMRES_IGNORED
        
    
if(!is_user_alive(host) || !is_user_alive(user))
        return 
FMRES_IGNORED
        
    
if(!zp_core_is_zombie(user))
        return 
FMRES_IGNORED
        
    
if(host == user)
        return 
FMRES_IGNORED
    
    
new Float:PlayerOrigin[3]
    
pev(userpev_originPlayerOrigin)
                            
    
PlayerOrigin[2] += 60.0
                        
    engfunc
(EngFunc_SetOriging_playerbar[user], PlayerOrigin)
    
set_pev(g_playerbar[user], pev_effectspev(g_playerbar[user], pev_effects) & ~EF_NODRAW)

    return 
FMRES_HANDLED


Last edited by felipemilralze; 03-10-2017 at 16:06.
felipemilralze is offline
Send a message via MSN to felipemilralze Send a message via Skype™ to felipemilralze
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:00.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode