Approved Show Zombie HP

Gameplay Addons
Post Reply
User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2211
Joined: 5 Years Ago
Has thanked: 55 times
Been thanked: 171 times
Age: 24
Contact:

Show Zombie HP

#1

Post by Raheem » 5 Years Ago

Show Zombie HP

Description:
  • This plugin will show a Hud message when you attack or make damage for the zombie. This message will tell you his HP.

Cvars:
  • ze_hpremain_mode 1 Type of HP remaining ( 1 = Normal | 0 = HUD )
  • ze_hpremain_commas 1 Enable or Disable Adding Commas to HP? 1 = Enable | 0 = Disable
Installation & Instructions:
  • Simply install it like any plugin.

Changelog:
  • Spoiler!
    Version: 1.0
    • First Release.
    Version: 1.1
    • Added new Cvar for Commas.
    • Fixed problem that message was show everytime zombie take damage from anything.
    Version: 1.2 [Current Version]
    • Update Cvars.
    • Added HUD mode.
    • Fixed show HP when infect player.
Screenshots:
  • ze_atix_assault_u30000.jpg
    Pic0
    ze_atix_assault_u30001.jpg
    Pic1
    ze_atix_assault_u30002.jpg
    Pic2
    ze_atix_assault_u30003.jpg
    Pic3
    ze_atix_assault_u30004.jpg
    Pic4
Downloads:
He who fails to plan is planning to fail

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2211
Joined: 5 Years Ago
Has thanked: 55 times
Been thanked: 171 times
Age: 24
Contact:

#2

Post by Raheem » 5 Years Ago

New version Released.
Current Version Now: 1.1
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 595
Joined: 5 Years Ago
Has thanked: 20 times
Been thanked: 15 times
Contact:

#3

Post by czirimbolo » 4 Years Ago

L 08/11/2018 - 09:42:11: Invalid player id 96
L 08/11/2018 - 09:42:11: [AMXX] Displaying debug trace (plugin "ze_show_zombie_hp.amxx", version "1.1")
L 08/11/2018 - 09:42:11: [AMXX] Run time error 10: native error (native "client_print")
L 08/11/2018 - 09:42:11: [AMXX] [0] ze_show_zombie_hp.sma::Fw_TakeDamage_Post (line 24)

This crashed me server 2 times
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2211
Joined: 5 Years Ago
Has thanked: 55 times
Been thanked: 171 times
Age: 24
Contact:

#4

Post by Raheem » 4 Years Ago

Invalid id errors can not crash the server, it's only logged and the message won't be sent if it's invalid. Anyway i added checks to know if this user valid or not:
  • Code: Select all

    #include <zombie_escape>
    
    new cvar_enable_commas
    
    public plugin_init()
    {
        register_plugin("[ZE] Show Zombie HP", "1.1", "Raheem")
        
        // Hook Chains
        RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
    	
    	// Cvars
        cvar_enable_commas = register_cvar("ze_enable_commas_hp", "1")
    }
    
    public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
    {
    	if (!is_user_alive(iVictim) || !is_user_alive(iAttacker))
    		return
    	
        if (get_member(iAttacker, m_iTeam) == TEAM_CT && get_member(iVictim, m_iTeam) == TEAM_TERRORIST)
    	{
    		if (get_pcvar_num(cvar_enable_commas) == 1)
    		{
    			new szHealth[15];
    			AddCommas(get_user_health(iVictim), szHealth, charsmax(szHealth))
    			client_print(iAttacker, print_center,"HP: %s", szHealth)
    		}
    		else
    		{
    			client_print(iAttacker, print_center,"HP: %i", get_user_health(iVictim))
    		}
    	}
    }
He who fails to plan is planning to fail

BandiT
Member
Member
Romania
Posts: 59
Joined: 2 Years Ago
Has thanked: 4 times
Been thanked: 7 times
Contact:

#5

Post by BandiT » 1 Year Ago

czirimbolo wrote:
4 Years Ago
L 08/11/2018 - 09:42:11: Invalid player id 96
L 08/11/2018 - 09:42:11: [AMXX] Displaying debug trace (plugin "ze_show_zombie_hp.amxx", version "1.1")
L 08/11/2018 - 09:42:11: [AMXX] Run time error 10: native error (native "client_print")
L 08/11/2018 - 09:42:11: [AMXX] [0] ze_show_zombie_hp.sma::Fw_TakeDamage_Post (line 24)

This crashed me server 2 times
do you have the fixed plugin ?
These users thanked the author BandiT for the post:
mldxx (1 Year Ago)

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 595
Joined: 5 Years Ago
Has thanked: 20 times
Been thanked: 15 times
Contact:

#6

Post by czirimbolo » 1 Year Ago

I use this:

Code: Select all

#include <zombie_escape>

new cvar_enable_commas

public plugin_init()
{
    register_plugin("[ZE] Show Zombie HP", "1.1", "Raheem")
    
    // Hook Chains
    RegisterHookChain(RG_CBasePlayer_TakeDamage, "Fw_TakeDamage_Post", 1)
	
	// Cvars
    cvar_enable_commas = register_cvar("ze_enable_commas_hp", "1")
}

public Fw_TakeDamage_Post(iVictim, iInflictor, iAttacker, Float:fDamage, bitsDamageType)
{
	if (!is_user_alive(iVictim) || !is_user_alive(iAttacker))
		return
	
    if (get_member(iAttacker, m_iTeam) == TEAM_CT && get_member(iVictim, m_iTeam) == TEAM_TERRORIST)
	{
		if (get_pcvar_num(cvar_enable_commas) == 1)
		{
			new szHealth[15];
			AddCommas(get_user_health(iVictim), szHealth, charsmax(szHealth))
			client_print(iAttacker, print_center,"HP: %s", szHealth)
		}
		else
		{
			client_print(iAttacker, print_center,"HP: %i", get_user_health(iVictim))
		}
	}
}
Image

BandiT
Member
Member
Romania
Posts: 59
Joined: 2 Years Ago
Has thanked: 4 times
Been thanked: 7 times
Contact:

#7

Post by BandiT » 1 Year Ago

Thanks

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 422
Joined: 3 Years Ago
Location: Morocco
Has thanked: 141 times
Been thanked: 48 times
Age: 20
Contact:

#8

Post by z0h1r-LK » 1 Month Ago

Updated to 1.2

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 2 guests