Small question regarding "func_breakable"

For my gamemode I really need to some how make func_breakable to have specific increased amount of health sort of, so only players with specific weapons could break them, since I have way too many sweps, its not an option to make thouse weapons dont break thouse funcs.

Is there is anyway I can increase its health or maybe create somesort of whitelist for weapons which could break it?

I recommend using an

GM:EntityTakeDamage hook.

Use

Entity:GetClass to check if the entity is func_breakable, and if so, decrease the damage using

CTakeDamageInfo:SetDamage or

CTakeDamageInfo:ScaleDamage.

Hi there, tried to use it here is what I ended up with


function GM:EntityTakeDamage( target, dmginfo )
 if (ent:GetClass() == "func_breakable" && dmginfo:GetDamage() < 1000 ) then
dmginfo:SetDamage( 0 )
end
end


Put it a init file of my gamemode, but its not workins, can you point me what I did wrong.

Ent isn’t defined. Target is though.

To clarify MPan1’s post, he/she means that the argument you named “target” is the entity you are trying to call with “ent”. In other words, replace ent with target.