Thread: Show zombie hp
View Single Post
Author Message
deadackerman
Junior Member
Join Date: Oct 2023
Old 05-01-2024 , 19:05   Show zombie hp
Reply With Quote #1

When dealing damage to a zombie, it does not show its HP. How can it be fixed?

screen: https://ibb.co/dt40HfP
meta lists:
PHP Code:
 1AMX Mod X        RUN   -    amxmodx_mm.dll        v1.9.0.5294      ini  Start ANY
 
2Reunion          RUN   -    reunion_mm.dll        v0.1.92d         ini  Start Never
 
3Revoice          RUN   -    revoice_mm.dll        v0.1.0.34        ini  Start Never
 
4POD-Bot mm       RUN   -    podbot_mm.dll         v3.0B18c         ini  Chlvl ANY
 
5SafeNameAndChat  RUN   -    safenameandchat.dll   v1.2 Beta 3      ini  ANY   ANY
 
6MySQL            RUN   -    mysql_amxx.dll        v1.9.0.5294      pl1  ANY   ANY
 
7SQLite           RUN   -    sqlite_amxx.dll       v1.9.0.5294      pl1  ANY   ANY
 
8Fun              RUN   -    fun_amxx.dll          v1.9.0.5294      pl1  ANY   ANY
 
9Engine           RUN   -    engine_amxx.dll       v1.9.0.5294      pl1  ANY   ANY
 
[10FakeMeta         RUN   -    fakemeta_amxx.dll     v1.9.0.5294      pl1  ANY   ANY
 
[11CStrike          RUN   -    cstrike_amxx.dll      v1.9.0.5294      pl1  ANY   ANY
 
[12CSX              RUN   -    csx_amxx.dll          v1.9.0.5294      pl1  ANY   ANY
 
[13Ham Sandwich     RUN   -    hamsandwich_amxx.dll  v1.9.0.5294      pl1  ANY   ANY
 
[14ReAPI            RUN   -    reapi_amxx.dll        v5.24.0.300-dev  pl1  ANY   Never 
code:

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>

// Uncomment this if you want to show the taken damage
//#define SHOW_DAMAGE_ON_MESSAGE

// Integers
new g_iMaxPlayers

// Bools
new bool:g_bIsConnected[33]

// Macros
#define IsConnected(%1) (1 <= %1 <= g_iMaxPlayers && g_bIsConnected[%1])

#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "meTaLiCroSS"

public plugin_init() 
{
    
register_plugin("[ZP] Addon: Zombie HP Displayer"PLUGIN_VERSIONPLUGIN_AUTHOR)
    
    
RegisterHam(Ham_TakeDamage"player""fw_Player_TakeDamage_Post"1)
    
    
g_iMaxPlayers get_maxplayers()
}

public 
client_putinserver(iIdg_bIsConnected[iId] = true
public client_disconnected(iIdg_bIsConnected[iId] = false

public fw_Player_TakeDamage_Post(iVictimiInflictoriAttackerFloat:flDamageiDamageType)
{
    if(!
IsConnected(iAttacker) || iVictim == iAttacker)
        return 
HAM_IGNORED
    
    
if(zp_get_user_zombie(iVictim))
    {
        
// I use statics variables
        // because this forward can (or not)
        // be called many times.
        
static iVictimHealth
        iVictimHealth 
get_user_health(iVictim)
        
        if(
iVictimHealth)
        
#if defined SHOW_DAMAGE_ON_MESSAGE
            
client_print(iAttackerprint_center"You did %.1f Damage. Health: %d"flDamageiVictimHealth)  
        
#else
            
client_print(iAttackerprint_center"Health: %d"iVictimHealth)  
        
#endif
        
else
            
client_print(iAttackerprint_center"You Killed him")
            
        return 
HAM_HANDLED
    
}
    
    return 
HAM_IGNORED


Last edited by deadackerman; 05-01-2024 at 19:12.
deadackerman is offline