Prevent certain ammo and explosive to damage something

hello, I tried to prevent damage to something in this case im testing to prevent C4 damage the Bradley?

can someone help me?

Rules:
"C4 cannot hurt Bradley"

C4 and Bradley only in these entity group but still taking damage

{
"name": "C4",
"members": "RFTimed.explosive, explosive.timed",
"exclusions": ""
},
{
"name": "Bradley",
"members": "BradleyAPC",
"exclusions": ""
}

 

you will have to trace it with tpve.trace

info on how to do so is pinned to this forum

Hello Nivex.

Thanks for the response.

I did trace, but the output is BasePlayer. Here is what I got:

From: BasePlayer, player
To: BradleyAPC, bradleyapc
Checking exclusions between [launch_site, Launch Site] and [launch_site, Launch Site]
Shared locations: launch_site
Found exclusion mapping for location: launch_site
Exclusion found; allow and return

 

I have tested it in both PVP zones and outside with the same result. 

ya, it should always be BasePlayer when thrown by a player. this is no different than if a player were to use a gun. it should show the player and not the gun. this is vanilla behavior. either way, this won't work because you are using exclusions. exclusions are excluded =p

what you need is a custom plugin to do this for you. every server should have a plugin that contains small portions of code specific to their servers needs anyway. I have not tested this so it may not even work. if it does then it would ONLY block damage to the bradley if from a timed explosive

save as Ruley.cs

namespace Oxide.Plugins
{
    [Info("Ruley", "nivex", "0.1.0")]
    [Description("For the Ruley server.")]
    class Ruley : RustPlugin
    {
        private object CanEntityTakeDamage(BradleyAPC apc, HitInfo info) => info != null && info.WeaponPrefab != null && info.WeaponPrefab.ShortPrefabName.Contains("explosive.timed") ? false : (object)null;
    }
}​
Thank you so much, Nivex.
wasn't thinking about you making this code just for me, but I'm sure this would be useful for the other server owners as well.
Thank you very much! You are the BEST. :)