Suggested Zombie Health Bar

Plug-ins compatibility with Zombie Escape 1.x only!


Post Reply
User avatar
Kokorov
Member
Member
Indonesia
Posts: 1
Joined: 6 years ago
Location: Indonesia
Contact:

#11

Post by Kokorov » 6 years ago

nice one.

DeVil_Raghav
Member
Member
India
Posts: 25
Joined: 3 years ago
Contact:

#12

Post by DeVil_Raghav » 3 years ago

Can any one make it for human?

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#13

Post by Night Fury » 3 years ago

DeVil_Raghav wrote: 3 years ago Can any one make it for human?
Try:

Code: Select all

    #include <zombie_escape>
     
    #define PLUGIN "[ZE] Addon: Show Health Bar"
    #define VERSION "1.0"
    #define AUTHOR "ZE DEV TEAM"
     
    new const healthbar_spr[] = "sprites/zb_healthbar.spr"
    new g_playerbar[33] , g_isAlive[33]
    new g_playerMaxHealth[33]
     
    public plugin_init()
    {
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        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 playerBar, allocString
        allocString = engfunc(EngFunc_AllocString, "env_sprite")
       
        for( new id = 1; id <= get_maxplayers(); id ++ )
        {
            g_playerbar[id] = engfunc(EngFunc_CreateNamedEntity, allocString)
            playerBar = g_playerbar[id]
           
            if(pev_valid(playerBar))
            {
                set_pev(playerBar, pev_scale, 0.25)
                engfunc(EngFunc_SetModel, playerBar, healthbar_spr)
                set_pev(playerBar, pev_effects, pev(playerBar, pev_effects ) | EF_NODRAW)
            }
        }  
    }
     
    public plugin_precache() engfunc(EngFunc_PrecacheModel, healthbar_spr)
     
    public ham_spawn_post(id)
    {
        if(is_user_alive(id))
        {
            g_isAlive[id] = 1
        }
    }
     
    public ze_user_infected(id)
    {
        set_pev(g_playerbar[id], pev_effects, pev(g_playerbar[id], pev_effects) | EF_NODRAW)
    }
     
    public ze_user_humanized(id)
    {
        g_playerMaxHealth[id] = get_user_health(id)
    }
     
    public client_disconnect(id)
    {
        set_pev(g_playerbar[id], pev_effects, pev(g_playerbar[id], pev_effects) | EF_NODRAW)
    }
     
    public event_resethud(id)
    {
        set_pev(g_playerbar[id], pev_effects, pev(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_effects, pev(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_frame, 99.0)
        }
        else
        {
            set_pev(g_playerbar[id], pev_frame, 0.0 + (((hp - 1) * 100) / g_playerMaxHealth[id]))
        }
    }
     
    public fm_addtofullpack_post(es, e, user, host, host_flags, player, p_set)
    {
        if(!player)
            return FMRES_IGNORED
           
        if(!is_user_alive(host) || !is_user_alive(user))
            return FMRES_IGNORED
           
        if(ze_is_user_zombie(user))
            return FMRES_IGNORED
           
        if(host == user)
            return FMRES_IGNORED
       
        new Float:PlayerOrigin[3]
        pev(user, pev_origin, PlayerOrigin)
                               
        PlayerOrigin[2] += 60.0
                           
        engfunc(EngFunc_SetOrigin, g_playerbar[user], PlayerOrigin)
        set_pev(g_playerbar[user], pev_effects, pev(g_playerbar[user], pev_effects) & ~EF_NODRAW)
     
        return FMRES_HANDLED
    }
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

DeVil_Raghav
Member
Member
India
Posts: 25
Joined: 3 years ago
Contact:

#14

Post by DeVil_Raghav » 3 years ago

Mohamed Alaa wrote: 3 years ago
DeVil_Raghav wrote: 3 years ago Can any one make it for human?
Try:

Code: Select all

    #include <zombie_escape>
     
    #define PLUGIN "[ZE] Addon: Show Health Bar"
    #define VERSION "1.0"
    #define AUTHOR "ZE DEV TEAM"
     
    new const healthbar_spr[] = "sprites/zb_healthbar.spr"
    new g_playerbar[33] , g_isAlive[33]
    new g_playerMaxHealth[33]
     
    public plugin_init()
    {
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        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 playerBar, allocString
        allocString = engfunc(EngFunc_AllocString, "env_sprite")
       
        for( new id = 1; id <= get_maxplayers(); id ++ )
        {
            g_playerbar[id] = engfunc(EngFunc_CreateNamedEntity, allocString)
            playerBar = g_playerbar[id]
           
            if(pev_valid(playerBar))
            {
                set_pev(playerBar, pev_scale, 0.25)
                engfunc(EngFunc_SetModel, playerBar, healthbar_spr)
                set_pev(playerBar, pev_effects, pev(playerBar, pev_effects ) | EF_NODRAW)
            }
        }  
    }
     
    public plugin_precache() engfunc(EngFunc_PrecacheModel, healthbar_spr)
     
    public ham_spawn_post(id)
    {
        if(is_user_alive(id))
        {
            g_isAlive[id] = 1
        }
    }
     
    public ze_user_infected(id)
    {
        set_pev(g_playerbar[id], pev_effects, pev(g_playerbar[id], pev_effects) | EF_NODRAW)
    }
     
    public ze_user_humanized(id)
    {
        g_playerMaxHealth[id] = get_user_health(id)
    }
     
    public client_disconnect(id)
    {
        set_pev(g_playerbar[id], pev_effects, pev(g_playerbar[id], pev_effects) | EF_NODRAW)
    }
     
    public event_resethud(id)
    {
        set_pev(g_playerbar[id], pev_effects, pev(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_effects, pev(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_frame, 99.0)
        }
        else
        {
            set_pev(g_playerbar[id], pev_frame, 0.0 + (((hp - 1) * 100) / g_playerMaxHealth[id]))
        }
    }
     
    public fm_addtofullpack_post(es, e, user, host, host_flags, player, p_set)
    {
        if(!player)
            return FMRES_IGNORED
           
        if(!is_user_alive(host) || !is_user_alive(user))
            return FMRES_IGNORED
           
        if(!ze_is_user_zombie(user))
            return FMRES_IGNORED
           
        if(host == user)
            return FMRES_IGNORED
       
        new Float:PlayerOrigin[3]
        pev(user, pev_origin, PlayerOrigin)
                               
        PlayerOrigin[2] += 60.0
                           
        engfunc(EngFunc_SetOrigin, g_playerbar[user], PlayerOrigin)
        set_pev(g_playerbar[user], pev_effects, pev(g_playerbar[user], pev_effects) & ~EF_NODRAW)
     
        return FMRES_HANDLED
    }
It just show's time not the health bar(not talking about hud bar)

Also show a warnig while compiling in the pic. :)
Attachments
warnig error is in this pic :)
warnig error is in this pic :)
code not working
code not working

DeVil_Raghav
Member
Member
India
Posts: 25
Joined: 3 years ago
Contact:

#15

Post by DeVil_Raghav » 3 years ago

Up

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#16

Post by Night Fury » 3 years ago

Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

DeVil_Raghav
Member
Member
India
Posts: 25
Joined: 3 years ago
Contact:

#17

Post by DeVil_Raghav » 3 years ago

Mohamed Alaa wrote: 3 years ago Code updated: viewtopic.php?p=11150#p11150
Sorry but the code is not working and shows the following warning/ error while compiling(IN THE PICTURE) PLEASE help

Thank you :)
Attachments
warning or error
warning or error

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#18

Post by Night Fury » 3 years ago

that's not an error.
If you want to fix, replace client_disconnect with client_disconnected
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

DeVil_Raghav
Member
Member
India
Posts: 25
Joined: 3 years ago
Contact:

#19

Post by DeVil_Raghav » 3 years ago

Mohamed Alaa wrote: 3 years ago that's not an error.
If you want to fix, replace client_disconnect with client_disconnected
that warnings is fixed but the plugin is not working. The plugin gets compile easly but it donot do anything, no health bar.
By saying health bar i mean by, the bar of cs 1.6 which shows health and armor. Only time in the center and in HUD health and human/zombie class and escape coins is visible(see the picture I attached to see what I am talking about)
Attachments
IMG20200718122742.jpg

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 0 guests