Raised This Month: $51 Target: $400
 12% 

Help / Support [ZP] Health Bar problem / Please Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nemesa95
Junior Member
Join Date: Jul 2017
Location: Hungary
Old 01-29-2023 , 22:44   [ZP] Health Bar problem / Please Help
Reply With Quote #1

Hy guys!

Im using the [ZP] Health Bar plugin on my ZM server, like this:

https://www.youtube.com/watch?v=7X-h...Ufuk%C3%96ZALP

...but i have a little problem.

I have a zombie class on my server, when he crouches he becomes invisible. But the Health bar remains above her head, so revealing her.

I am attaching the zombie class .sma file. Can someone rewrite it for me so that the Health bar is not above the head?!

zombie class .sma:
PHP Code:
/*
            [ZP] Class : [A]dvanced [I]nvisible Zombie
                ( special Zombie class )
                    by Fry!
                    
                    
    Description :
            
            AI zombie in full name ( Advanced Invisible ) have ability when you duck you will be invisible.
            Zombie has a weird feature when you will duck you will breathe out some sounds. Invisible can change by cvar.
    
    
    Cvars :
    
            zp_ai_zombie_invisibility "0"    - Amount of invisibility (0 max invisible - 255 max visible)
    
    
    Changelog :
    
            16/06/2009 - v1.0 - First release
            28/06/2009 - v1.0.5 - removed if player is connected or disconnected, dropped death event, fixed minor bug, removed player flag if he is on ground, optimized code.
            12/07/2009 - v1.0.8 - changing else instead of if in second flag check, removed stock, added 2 sounds while zombie is ducking to know if he is near you.
*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

#define PLUGIN "[ZP] Class : [A]dvanced [I]nvisible Zombie"
#define VERSION "1.0.8"
#define AUTHOR "Fry!"

new const zclass_name[] = "Demon"
new const zclass_info[] = "Guggolva lathatatlan"
new const zclass_model[] = "zombie_source"
new const zclass_clawmodel[] = "v_knife_zombie.mdl"
const zclass_health 1600
const zclass_speed 190
const Float:zclass_gravity 1.0
const Float:zclass_knockback 1.35

new const zombie_idle_sound1[] = "zz/ghost.wav"
new const zombie_idle_sound2[] = "zz/ghost.wav" 

new zisAzisB
new g_zclass_ai_zombieg_ai_zombie_invisible

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_cvar("zp_zclass_advanced_invisble_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
    
g_ai_zombie_invisible register_cvar("zp_ai_zombie_invisibility""0")
    
    
register_forward(FM_PlayerPreThink"fm_PlayerPreThink")
}

public 
plugin_precache()
{
    
g_zclass_ai_zombie zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)

    
zisA engfunc(EngFunc_PrecacheSoundzombie_idle_sound1)
    
zisB engfunc(EngFunc_PrecacheSoundzombie_idle_sound2)
}

public 
zp_user_infected_post(playerinfector)
{
    if (
zp_get_user_zombie_class(player) == g_zclass_ai_zombie)
    {
        if ((
pev(playerpev_flags) & FL_DUCKING))
        {
            
set_pev(playerpev_renderfxkRenderFxGlowShell)
            
set_pev(playerpev_rendermodekRenderTransAlpha)
            
set_pev(playerpev_renderamtget_pcvar_float(g_ai_zombie_invisible))
        }
    }
    return 
PLUGIN_CONTINUE
}

public 
fm_PlayerPreThink(id)
{
    if (!
is_user_alive(id) || !zp_get_user_zombie(id))
        return 
FMRES_IGNORED
        
    
if (zp_get_user_zombie_class(id) != g_zclass_ai_zombie)
        return 
FMRES_IGNORED
    
    
if (!(pev(idpev_flags) & FL_DUCKING))
    {
        
set_pev(idpev_renderfxkRenderFxNone)
        
set_pev(idpev_rendermodekRenderNormal)
        
set_pev(idpev_renderamt255.0)
        
        new 
iRandomNum random_num(zisAzisB)
        
        if (
iRandomNum == zisA)
        {
            
emit_sound(idCHAN_VOICEzombie_idle_sound1VOL_NORMATTN_NORM0PITCH_NORM)
        }
        
        else if (
iRandomNum == zisB)
        {
            
emit_sound(idCHAN_VOICEzombie_idle_sound2VOL_NORMATTN_NORM0PITCH_NORM)
        }
    }
        
    else
    {
        
set_pev(idpev_renderfxkRenderFxGlowShell)
        
set_pev(idpev_rendermodekRenderTransAlpha)
        
set_pev(idpev_renderamtget_pcvar_float(g_ai_zombie_invisible))
    }

    return 
FMRES_IGNORED
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 
...and the health bar .sma:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

#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_user_infected_post(id)
{
    
g_playerMaxHealth[id] = get_user_health(id)
}

public 
zp_user_humanized_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_get_user_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

Thank you very much guys if somebody can help me!
nemesa95 is offline
nemesa95
Junior Member
Join Date: Jul 2017
Location: Hungary
Old 02-04-2023 , 03:34   Re: [ZP] Health Bar problem / Please Help
Reply With Quote #2

Anybody can help me please?!

I really want this problem to solve in my server...
nemesa95 is offline
Reply



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 02:18.


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