Approved Show Zombie HP

Gameplay Addons
Post Reply
User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2183
Joined: 4 Years Ago
Has thanked: 49 times
Been thanked: 147 times
Age: 23
Contact:

Show Zombie HP

#1

Post by Raheem » 4 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_enable_commas_hp 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 [Current Version]
    • Added new Cvar for Commas.
    • Fixed problem that message was show everytime zombie take damage from anything.

Screenshots:
  • ImageImageImageImage

Downloads:
He who fails to plan is planning to fail

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2183
Joined: 4 Years Ago
Has thanked: 49 times
Been thanked: 147 times
Age: 23
Contact:

#2

Post by Raheem » 4 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: 571
Joined: 4 Years Ago
Has thanked: 20 times
Been thanked: 2 times
Contact:

#3

Post by czirimbolo » 2 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: 2183
Joined: 4 Years Ago
Has thanked: 49 times
Been thanked: 147 times
Age: 23
Contact:

#4

Post by Raheem » 2 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: 56
Joined: 1 Year Ago
Has thanked: 4 times
Been thanked: 4 times
Contact:

#5

Post by BandiT » 4 Days Ago

czirimbolo wrote:
2 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 ?

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 571
Joined: 4 Years Ago
Has thanked: 20 times
Been thanked: 2 times
Contact:

#6

Post by czirimbolo » 3 Days 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: 56
Joined: 1 Year Ago
Has thanked: 4 times
Been thanked: 4 times
Contact:

#7

Post by BandiT » 2 Days Ago

Thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests