View Single Post
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen.
Old 06-21-2013 , 07:31   Re: [SDK hooks] public Action:OnTakeDamage
Reply With Quote #3

Quote:
Originally Posted by Sillium View Post
Just a wild guess:
What is your return value?


I know, my code is propably the worst you have see ever but maybe you can help me ?

Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{	
	
	if(armor >= 1){
	
		intdamage = RoundFloat(damage);
	
		armor-=intdamage;
	
		ClearSyncHud(victim, hHudText);
		SetHudTextParams(-0.75, 0.90, 45.0, 40, 151, 249, 255);
		ShowSyncHudText(victim, hHudText, "Armor : %i", armor);
		
		return Plugin_Handled;
	}
	else{
	
		SetEntProp(victim, Prop_Send, "m_iHealth", GetClientHealth(victim) - intdamage);
		
		currentHP = GetClientHealth(victim);
		
		if(currentHP <= 0){
			ForcePlayerSuicide(victim);
		}
		
		return Plugin_Handled;
		
	}
	
	if(armor <= -1){
		ClearSyncHud(victim, hHudText);
		armor = 0;
		PrintHintText(victim, "Your armor is now DESTROYED !");
		
		return Plugin_Handled;
	}
	
	return Plugin_Stop;
}

Last edited by Arkarr; 06-21-2013 at 07:34.
Arkarr is offline