Help with making a enity/player fire proof and Explosive proof

i cant seem to find a way to make a player not take damage from fire and explosives, could some one help me?

Thank you all so much


hook.Add("EntityTakeDamage", function( target, dmginfo )

	if ( target:IsPlayer() ) then


                if dmginfo:IsExplosionDamage() or dmginfo:IsDamageType(DMG_BURN) then -- check its burn or explosion.
		      dmginfo:ScaleDamage( 0 ) -- no damages
                end

	end

end)


it didnt work :L [ERROR] attempt to index local ‘dmginfo’ (a nil value)

Instead of using ScaleDamage just return true and make sure you’re running the script on the server.

i will give it ago

[editline]1st October 2017[/editline]

i got there in the end