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

[Request] No healing when hit a teammate


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Yeoo
Junior Member
Join Date: Nov 2020
Old 12-03-2023 , 15:43   [Request] No healing when hit a teammate
Reply With Quote #1

Hi, I have this Vampire Zombie class which should heal when it hits an enemy, but it also heal when it hits an ally.
Can someone modify it so it wont heal if u hit an ally ?

Code:
#include <amxmodx>
#include <fakemeta>
#include <basebuilder>
#include <hamsandwich>
#include <fun>
#include <xs>

// Plugin stuff
new const PLUGIN[] = "[ZP] Zombie Class: Vampire Zombie"
new const VERSION[] = "1.0"
new const AUTHOR[] = "NiHiLaNTh"

// Zombie parametres
new const zclass5_name[] = { "Vampire Zombie" } // name
new const zclass5_info[] = { "\r[\wV.I.P\r]" } // description
new const zclass5_model[] = { "baseb_SnowMan" } // player model
new const zclass5_clawmodel[] = { "v_candycane_snowman_bb" } // claw model
const zclass5_health = 1500 // health
const zclass5_speed = 220 // speed
const Float:zclass5_gravity = 0.7 // gravity
const zclass5_admin = ADMIN_LEVEL_H
const zclass5_credits = 0

// Class ID
new g_zclass_vampire;

// CVAR pointers
new pcv_multi;

// Zombie classes must be registered on plugin precache
public plugin_precache()
{
	g_zclass_vampire = bb_register_zombie_class(zclass5_name, zclass5_info, zclass5_model, zclass5_clawmodel, zclass5_health, zclass5_speed, zclass5_gravity, 0.0, zclass5_admin, zclass5_credits);
}

// Plugin initialization
public plugin_init()
{
	// Register our plugin
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	// Forward
	RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
	
	// CVAR
	pcv_multi = register_cvar("zp_vampire_multi", "2") // additional health multiplier
}

// Target has been injected...
public zp_user_infected_post(id, infector, nemesis)
{
	// Our zm class
	if (zp_get_user_zombie_class(id) == g_zclass_vampire)
	{
		client_print(id, print_chat, "[ZP] Damage or infect someone to get additional health.");
		VampireInit(id);
	}
	
	// Vampire zombie cannot damage anyone on Single/Multi infection rounds so...
	if (zp_get_user_zombie_class(infector) == g_zclass_vampire)
	{
		set_pev(infector, pev_health, float(pev(infector, pev_health) + 1000))
	}
}

// Victim took damage from entity
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
	// Not alive
	if (!is_user_alive(victim))
		return;
		
	if (!zp_get_user_zombie(attacker))
		return;
	
	if (zp_get_user_zombie_class(attacker) == g_zclass_vampire)
	{
		// Calculate additional health
		static ExtraHealth;
		ExtraHealth = floatround(damage * get_pcvar_num(pcv_multi))
		
		// Set new health
		set_pev(attacker, pev_health, float(pev(attacker, pev_health) + ExtraHealth))
	}
}		

// Vampire zombie was born...
public VampireInit(id)
{
	// Not alive
	if (!is_user_alive(id))
		return PLUGIN_CONTINUE;
	
	// Not our zombie class
	if (zp_get_user_zombie_class(id) != g_zclass_vampire)
		return PLUGIN_CONTINUE;
	
	return PLUGIN_CONTINUE;
}
Yeoo is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-03-2023 , 16:56   Re: [Request] No healing when hit a teammate
Reply With Quote #2

Spoiler
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Yeoo
Junior Member
Join Date: Nov 2020
Old 12-03-2023 , 17:23   Re: [Request] No healing when hit a teammate
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
Spoiler
Thank u but I solve it by adding and it works )

HTML Code:
	if (cs_get_user_team(victim) != CS_TEAM_CT)
		return;
Yeoo 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 17:19.


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