Raised This Month: $ Target: $400
 0% 

Take damage not working properly


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 08-07-2020 , 11:23   Take damage not working properly
Reply With Quote #1

Hey everyone.
Everything i working fine expect ammo packs in not rewarded to g_sniper and g_zadoc according to the damage.
Note. SNIPER_IGNOREAMMO and ZADOC_IGNOREAMMO is set to 0

Code --
Code:
// Ham Take Damage Forward
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type, ptr)
{
	// Non-player damage or self damage
	if (victim == attacker || !is_user_valid_connected(attacker))
	return HAM_IGNORED;

	
	// New round starting or round ended
	if (g_newround || g_endround)
	return HAM_SUPERCEDE;
	
	// Victim shouldn't take damage 
	if (g_nodamage[victim])
	return HAM_SUPERCEDE;
	
	// Prevent friendly fire
	if (g_zombie[attacker] == g_zombie[victim])
	return HAM_SUPERCEDE;

	// Set Sniper's damage
	if (g_sniper[attacker] && g_currentweapon[attacker] == CSW_AWP)
	SetHamParamFloat(4, SNIPER_DAMAGE)
	
	// Set Zadoc's damage		// Abhinash
	if (g_zadoc[attacker] && g_currentweapon[attacker] == CSW_KNIFE)
	SetHamParamFloat(4, get_pcvar_float(cvar_zadocdamage))

	
	// Attacker is human...
	if (!g_zombie[attacker])
	{
		// Armor multiplier for the final damage on normal zombies
		if (!g_nemesis[victim] && !g_assassin[victim] && !g_bombardier[victim] && !g_sniper[attacker] && !g_zadoc[attacker])		// Abhinash
		{
			damage *= get_pcvar_float(cvar_zombiearmor)
			SetHamParamFloat(4, damage)
		}
		
		// Reward ammo packs to humans for damaging zombies?	
		if (!g_zombie[attacker])
		{
			// Store damage dealt
			g_damagedealt_human[attacker] += floatround(damage)
			
			if(g_sniper[attacker])
			{
				if(SNIPER_IGNOREAMMO == 0)
				{
					while (g_damagedealt_human[attacker] >= 5000)
					{
						g_ammopacks[attacker]++
						g_damagedealt_human[attacker] -= 5000
					}
				}
				else
				{
					return HAM_IGNORED
				}
			}
			else if(g_survivor[attacker])
			{
				if(SURVIVOR_IGNOREAMMO == 0)
				{
					while (g_damagedealt_human[attacker] > 500)
					{
						g_ammopacks[attacker]++
						g_damagedealt_human[attacker] -= 500
					}
				}
				else
				{
					return HAM_IGNORED
				}
			}
			else if(g_zadoc[attacker])
			{
				if(ZADOC_IGNOREAMMO == 0)
				{
					while (g_damagedealt_human[attacker] > 5000)
					{
						g_ammopacks[attacker]++
						g_damagedealt_human[attacker] -= 5000
					}
				}
				else
				{
					return HAM_IGNORED
				}
			}
			else if(!g_sniper[attacker] || !g_survivor[attacker] || !g_zadoc[attacker])
			{
				while (g_damagedealt_human[attacker] > 500)
					{
						g_ammopacks[attacker]++
						g_damagedealt_human[attacker] -= 500
					}
			}
			
			return HAM_IGNORED
		}
		
		// Abhinash
		if (g_doubledamage[attacker])
		{
			damage *= 2.0;
			SetHamParamFloat(4, damage);
		}
		
		return HAM_IGNORED;
	}
	
	// Attacker is zombie...
	
	// Prevent infection/damage by HE grenade (bugfix)
	if (damage_type & DMG_HEGRENADE)
	return HAM_SUPERCEDE;
	
	// Nemesis?
	if (g_nemesis[attacker])
	{
		// Ignore nemesis damage override if damage comes from a 3rd party entity
		// (to prevent this from affecting a sub-plugin's rockets e.g.)
		if (inflictor == attacker)
		{
			// Set nemesis damage
			SetHamParamFloat(4, NEMESIS_DAMAGE)
		}
		
		return HAM_IGNORED;
	}
	else if (g_assassin[attacker])
	{
		// Ignore assassin damage override if damage comes from a 3rd party entity
		// (to prevent this from affecting a sub-plugin's rockets e.g.)
		if (inflictor == attacker)
		{
			// Set assassin damage
			SetHamParamFloat(4, ASSASSIN_DAMAGE)
		}
		
		return HAM_IGNORED;
	}
	else if (g_bombardier[attacker])
	{
		// Ignore assassin damage override if damage comes from a 3rd party entity
		// (to prevent this from affecting a sub-plugin's rockets e.g.)
		if (inflictor == attacker)
		{
			// Set assassin damage
			SetHamParamFloat(4, BOMBARDIER_DAMAGE)
		}
		
		return HAM_IGNORED;
	}
	
	// Reward ammo packs to zombies for damaging humans?
	if (get_pcvar_num(cvar_ammodamage_zombie) > 0)
	{
		// Store damage dealt
		g_damagedealt_zombie[attacker] += floatround(damage)
		
		// Reward ammo packs for every [ammo damage] dealt
		while (g_damagedealt_zombie[attacker] > get_pcvar_num(cvar_ammodamage_zombie))
		{
			g_ammopacks[attacker]++
			g_damagedealt_zombie[attacker] -= get_pcvar_num(cvar_ammodamage_zombie)
		}
	}
	
	// Last human or not an infection round
	if (g_survround || g_sniround || g_nemround || g_assaround || g_bombardierround/* Abhinash*/ || g_zadocround /* Abhinash */|| g_swarmround || g_plagueround || g_armageround || g_apocround || g_nightround || fnGetHumans() == 1)
	return HAM_IGNORED; // human is killed
	
	// Does human armor need to be reduced before infecting?
	if (get_pcvar_num(cvar_humanarmor))
	{
		// Get victim armor
		static Float:armor
		pev(victim, pev_armorvalue, armor)
		
		// If he has some, block the infection and reduce armor instead
		if (armor > 0.0)
		{
			emit_sound(victim, CHAN_BODY, sound_armorhit, 1.0, ATTN_NORM, 0, PITCH_NORM)
			if (armor - damage > 0.0)
			set_pev(victim, pev_armorvalue, armor - damage)
			else
			cs_set_user_armor(victim, 0, CS_ARMOR_NONE)
			return HAM_SUPERCEDE;
		}
	}
	
	// Infection allowed
	zombieme(victim, attacker, 0, 0, 0, 0, 1) // turn into zombie
	g_points[attacker]++		// Abhinash
	SavePoints(attacker)		// Abhinash
	return HAM_SUPERCEDE;
}

Last edited by Abhinash; 08-07-2020 at 11:24.
Abhinash is offline
 



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 13:54.


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