KiLL3R

SetCanDamage( <can damage> )


Module: Damage

Summary:

Set the candamage flag for this entity - this means that it can respond to notifies from bullets and grenade hits



Call this on:

script_model, script_origin or script_brushmodel



Example:

moitordamage()
{
	self SetCanDamage(true);
	self.maxhealth = 100;
	self.health = self.maxhealth;
	while(1)
	{
		self waittill("damage", iDamage, attacker, vDir, vPoint, sMeansOfDeath, modelName, tagName, partName, iDFlags);

		if(!isPlayer(attacker))
		{
			self.health += iDamage;
			continue;
		}

		if(!maps\mp\gametypes\_weapons::friendlyFireCheck(self.owner, attacker))
		{
			self.health += iDamage;
			continue;
		}

		if(self.health <= 0)
			break;
	}
	self playSound("grenade_explode_default");
	self delete();
}



Required Args:

  • 1 : <can damage> The can damage flag