Cant figure out how to set prop health.

Alright I know I must use. MyEntity:SetHealth() To set the props health and local iHealth = iEnt:Health( ) to see it. I also know they both go in the shared. However I cant get it to work. If someone could give me a example of it working with persay the blue barrel prop, so i could just paste it into the shared and see it work that would help. (I learn better from examples that work)

Bump (I really need help)

You’re suppose to wait 2 days before bumping really, but I’ll help you a little bit anyways.

The entities you are trying to use SetHealth() on do not have a variable for health, so you need to create one.


ENT.OurHealth = 25; -- Amount of damage that the entity can handle - set to 0 to make it indestructible
 
 function ENT:OnTakeDamage(dmg)
	self.Entity:TakePhysicsDamage(dmg); -- React physically when getting shot/blown
 
	if(self.Entity.OurHealth <= 0) then return; end -- If the health-variable is already zero or below it - do nothing
 
	self.Entity.OurHealth = self.Entity.OurHealth - dmg:GetDamage(); -- Reduce the amount of damage took from our health-variable
 
	if(self.Entity.OurHealth <= 0) then -- If our health-variable is zero or below it
		self.Entity:Remove(); -- Remove our entity
	end
 end

This would go in the init of the entity.

Oh and the actual function for local iHealth = iEnt:Health() is Entity:Health(), the local iHealth and iEnt is just a short cut.