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 [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/EntityTakeDamage]GM:EntityTakeDamage[/url] hook.
Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetClass]Entity:GetClass[/url] to check if the entity is func_breakable, and if so, decrease the damage using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CTakeDamageInfo/SetDamage]CTakeDamageInfo:SetDamage[/url] or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CTakeDamageInfo/ScaleDamage]CTakeDamageInfo:ScaleDamage[/url].
[QUOTE=MPan1;52688780]I recommend using an [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/EntityTakeDamage]GM:EntityTakeDamage[/url] hook.
Use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetClass]Entity:GetClass[/url] to check if the entity is func_breakable, and if so, decrease the damage using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CTakeDamageInfo/SetDamage]CTakeDamageInfo:SetDamage[/url] or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CTakeDamageInfo/ScaleDamage]CTakeDamageInfo:ScaleDamage[/url].[/QUOTE]
Hi there, tried to use it here is what I ended up with
[CODE]function GM:EntityTakeDamage( target, dmginfo )
if (ent:GetClass() == "func_breakable" && dmginfo:GetDamage() < 1000 ) then
dmginfo:SetDamage( 0 )
end
end
[/CODE]
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.
Sorry, you need to Log In to post a reply to this thread.