Prevent damage to carsSolved
Hello guys, dont have idea how to add cars to do dmg when crashing, i tried all...
"members": "hotairballoon, minicopter.entity, scraptransporthelicopter, _base_car_chassis.entity, modular_car_i4_engine_storage, modular_car_v8_engine_storage, car_chassis_2module.entity",
Any ideas what to put in members?
ModularCar would be one, and here's a list of all prefabs with modular in the name. Some may not apply. Just use the prefab name. So as you've used above _base_car_chassis.entity.prefab would be _base_car_chassis.entity. modularcarlift.static.prefab would be modularcarlift.static, etc

[assets/bundled/prefabs/static/modularcarlift.static.prefab, 3844433950]
[assets/bundled/prefabs/ui/lootpanels/lootpanel.modularcar.storage.prefab, 2598769393]
[assets/content/vehicles/modularcar/_base_car_chassis.entity.prefab, 3561890772]
[assets/content/vehicles/modularcar/2module_car_spawned.entity.prefab, 3730875555]
[assets/content/vehicles/modularcar/3module_car_spawned.entity.prefab, 3024716654]
[assets/content/vehicles/modularcar/4module_car_spawned.entity.prefab, 1823731789]
[assets/content/vehicles/modularcar/car_chassis_2module.entity.prefab, 3386615946]
[assets/content/vehicles/modularcar/car_chassis_3module.entity.prefab, 4140947108]
[assets/content/vehicles/modularcar/car_chassis_4module.entity.prefab, 1682477379]
[assets/content/vehicles/modularcar/carcollisioneffect.prefab, 4077784008]
[assets/content/vehicles/modularcar/colliders/back_a_col.prefab, 2412174288]
[assets/content/vehicles/modularcar/colliders/backpanel_col.prefab, 1527768162]
[assets/content/vehicles/modularcar/colliders/bumper_back_a_col.prefab, 2656993068]
[assets/content/vehicles/modularcar/colliders/bumper_back_a_worldcol.prefab, 1158734358]
[assets/content/vehicles/modularcar/colliders/bumper_front_a_col.prefab, 1435313850]
[assets/content/vehicles/modularcar/colliders/bumper_front_a_worldcol.prefab, 3960307676]
[assets/content/vehicles/modularcar/colliders/chassis_2_main_col.prefab, 3506028311]
[assets/content/vehicles/modularcar/colliders/chassis_3_main_col.prefab, 1095950598]
[assets/content/vehicles/modularcar/colliders/chassis_4_main_col.prefab, 2264220228]
[assets/content/vehicles/modularcar/colliders/chassis_axle_col.prefab, 3805108645]
[assets/content/vehicles/modularcar/colliders/cockpit_engine_front_a_col.prefab, 3403279451]
[assets/content/vehicles/modularcar/colliders/cockpit_front_a_col.prefab, 894763675]
[assets/content/vehicles/modularcar/colliders/cockpit_front_panel_a_col.prefab, 1175208081]
[assets/content/vehicles/modularcar/colliders/cockpit_main_a_col.prefab, 554786395]
[assets/content/vehicles/modularcar/colliders/cockpit_main_b_col.prefab, 3049576824]
[assets/content/vehicles/modularcar/colliders/cockpit_main_c_col.prefab, 3686111390]
[assets/content/vehicles/modularcar/colliders/engine_a_col.prefab, 3587585013]
[assets/content/vehicles/modularcar/colliders/engine_panel_a_col.prefab, 4075130234]
[assets/content/vehicles/modularcar/colliders/engine_panel_b_col.prefab, 1748875999]
[assets/content/vehicles/modularcar/colliders/engineframe_a_col.prefab, 2641881912]
[assets/content/vehicles/modularcar/colliders/flabed_front_a_col.prefab, 1102366074]
[assets/content/vehicles/modularcar/colliders/flatbed_a_col.prefab, 2820247342]
[assets/content/vehicles/modularcar/colliders/flatbed_b_col.prefab, 558398640]
[assets/content/vehicles/modularcar/colliders/flatbed_panel_a_col.prefab, 3567719651]
[assets/content/vehicles/modularcar/colliders/front_a_col.prefab, 549422252]
[assets/content/vehicles/modularcar/colliders/front_b_col.prefab, 3906975742]
[assets/content/vehicles/modularcar/colliders/middle_a_col.prefab, 4273230209]
[assets/content/vehicles/modularcar/colliders/panel_a_col.prefab, 2282683572]
[assets/content/vehicles/modularcar/colliders/panel_b_col.prefab, 1554217599]
[assets/content/vehicles/modularcar/colliders/seat_a_col.prefab, 892354201]
[assets/content/vehicles/modularcar/colliders/seat_b_col.prefab, 2483780065]
[assets/content/vehicles/modularcar/colliders/side_panel_a_col.prefab, 1368802874]
[assets/content/vehicles/modularcar/colliders/wheelframe_a_col.prefab, 2281767508]
[assets/content/vehicles/modularcar/colliders/wheelframe_b_col.prefab, 2505164807]
[assets/content/vehicles/modularcar/colliders/wheelframe_c_col.prefab, 1744917642]
[assets/content/vehicles/modularcar/colliders/wheelframe_d_col variant.prefab, 1643555868]
[assets/content/vehicles/modularcar/effects/wheel-impact.prefab, 2425188710]
[assets/content/vehicles/modularcar/engine_panel_c_col.prefab, 343453017]
[assets/content/vehicles/modularcar/models/components/centrallocking.prefab, 3891128153]
[assets/content/vehicles/modularcar/models/components/dashboardlight.prefab, 3471073190]
[assets/content/vehicles/modularcar/models/components/prefab/chassis_steering.prefab, 3395174308]
[assets/content/vehicles/modularcar/models/components/prefab/chassis_transmission.prefab, 3945393125]
[assets/content/vehicles/modularcar/models/components/prefab/headlight.prefab, 442026457]
[assets/content/vehicles/modularcar/models/components/prefab/seat_a.prefab, 4153985659]
[assets/content/vehicles/modularcar/models/components/prefab/seat_b.prefab, 3172657560]
[assets/content/vehicles/modularcar/models/components/prefab/steeringwheel_a.prefab, 2821241285]
[assets/content/vehicles/modularcar/models/components/prefab/taillight.prefab, 1917412774]
[assets/content/vehicles/modularcar/modular_car_wheel_collider.prefab, 2215807743]
[assets/content/vehicles/modularcar/module_entities/_base_car_module.prefab, 67955234]
[assets/content/vehicles/modularcar/module_entities/1module_cockpit.prefab, 3119250179]
[assets/content/vehicles/modularcar/module_entities/1module_cockpit_armored.prefab, 2424796981]
[assets/content/vehicles/modularcar/module_entities/1module_cockpit_with_engine.prefab, 3414464968]
[assets/content/vehicles/modularcar/module_entities/1module_engine.prefab, 178648441]
[assets/content/vehicles/modularcar/module_entities/1module_flatbed.prefab, 489918843]
[assets/content/vehicles/modularcar/module_entities/1module_rear_seats.prefab, 2075972945]
[assets/content/vehicles/modularcar/module_entities/1module_storage.prefab, 1074059713]
[assets/content/vehicles/modularcar/module_entities/2module_flatbed.prefab, 2028363846]
[assets/content/vehicles/modularcar/module_entities/2module_fuel_tank.prefab, 4177081746]
[assets/content/vehicles/modularcar/module_entities/2module_passengers.prefab, 2510161370]
[assets/content/vehicles/modularcar/randommodular.entity.prefab, 1765685486]
[assets/content/vehicles/modularcar/sound/modular-car-engine-test-nice-setup.prefab, 1766911746]
[assets/content/vehicles/modularcar/subents/modular_car_1mod_storage.prefab, 3180664242]
[assets/content/vehicles/modularcar/subents/modular_car_2mod_fuel_tank.prefab, 1803881164]
[assets/content/vehicles/modularcar/subents/modular_car_fuel_storage.prefab, 134803077]
[assets/content/vehicles/modularcar/subents/modular_car_i4_engine_storage.prefab, 3092307067]
[assets/content/vehicles/modularcar/subents/modular_car_v8_engine_storage.prefab, 4151790624]
[assets/prefabs/deployable/modular car lift/effects/modular-car-lift-deploy.prefab, 2623494141]
[assets/prefabs/deployable/modular car lift/electrical.modularcarlift.deployed.prefab, 428217161]
[assets/prefabs/deployable/modular car lift/electrical.modularcarlift.item.prefab, 2558058625]
[assets/prefabs/deployable/modular car lift/models/vehicle_lift.prefab, 1532983055]
[assets/prefabs/vehicle/seats/modularcardriverseat.prefab, 1924089654]
[assets/prefabs/vehicle/seats/modularcarpassengerseat.prefab, 3995677773]
[assets/prefabs/vehicle/seats/modularcarpassengerseatlesslegroom.prefab, 1727848904]​


easier solution would be to put the code below in a file, name it CarsImmunity.cs. this version disable dmg to cars except for decay

using Rust;

namespace Oxide.Plugins
{
    [Info("Cars Immunity", "nivex", "0.1.2")]
    [Description("Makes cars immune to damage")]
    public class CarsImmunity : RustPlugin
    {
        object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
        {
            if (entity == null || hitInfo == null || hitInfo.Initiator == null || hitInfo.damageTypes != null && hitInfo.damageTypes.Has(DamageType.Decay))
            {
                return null;
            }

            if (entity is ModularCar || hitInfo.Initiator is ModularCar || entity.PrefabName.Contains("modularcar") || hitInfo.Initiator.PrefabName.Contains("modularcar"))
            {
                hitInfo.damageTypes = new DamageTypeList();
                return true;
            }

            return null;
        }
    }
}


alternatively to disable decay also, just save to file CarsImmunity.cs

using Rust;

namespace Oxide.Plugins
{
    [Info("Cars Immunity", "nivex", "0.1.1")]
    [Description("Makes cars immune to damage")]
    public class CarsImmunity : RustPlugin
    {
        object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitInfo)
        {
            if (entity == null || hitInfo == null)
            {
                return null;
            }

            if (entity is ModularCar || hitInfo.Initiator is ModularCar || entity.PrefabName.Contains("modularcar") || hitInfo.Initiator != null && hitInfo.Initiator.PrefabName.Contains("modularcar"))
            {
                hitInfo.damageTypes = new DamageTypeList();
                return true;
            }

            return null;
        }
    }
}

But its PVE server with PVP zones so i want cars to take dmg, now i can ride into wall for 0 dmg and thats bad :/

"anything can hurt cars",
"players cannot hurt cars",
"cars cannot hurt players"

"name": "cars",
"members": "_base_car_chassis.entity, 2module_car_spawned.entity, 3module_car_spawned.entity, 4module_car_spawned.entity, car_chassis_2module.entity, car_chassis_3module.entity, car_chassis_4module.entity, 1module_cockpit, 1module_cockpit_armored, 1module_cockpit_with_engine, 1module_engine, 1module_flatbed, 1module_rear_seats, 1module_storage, 2module_flatbed, 2module_fuel_tank, 2module_passengers, randommodular.entity",
"exclusions": ""

 

Seems to work, and in PVP zone with my settings players can deal dmg to cars and cars can kill players, so thats perfect <3

Because the plugin developer added code to disable vehicle damage,
"anything can hurt car" doesn't work.

If you want to "anything can hurt car" do work, delete the code below.

/*if (entity is ModularCar || entity is BasicCar || hitInfo.Initiator is ModularCar || hitInfo.Initiator is BasicCar || entity.PrefabName.Contains("modularcar") || hitInfo.Initiator != null && hitInfo.Initiator.PrefabName.Contains("modularcar"))
{
if (ruleSet.HasFlag(RuleFlags.CarsImmunity))
{
if (trace) Trace("Car had a collision; block and return", 1);
return false;
}

return false;
}*/​
the double return false is fixed in next update. the last return false is not supposed to be there.

I'm having an issues making it where vehicles take no damage outside of pvp zones and taking damage inside of them. I set this up before and it worked but it is not working this time around. Here's my config.

{
  "Config Version": "1.2.0",
  "Default RuleSet": "default",
  "Configuration Options": {
    "handleDamage": true,
    "useZones": true
  },
  "Mappings": {
    "default": "default",
    "pvp": "pvp",
    "raid": "raid",
    "1933088460": "pvp",
    "1933092814": "pvp",
    "1933097819": "pvp",
    "1933102834": "pvp",
    "1933107874": "pvp",
    "1933112893": "pvp",
    "1933117898": "pvp",
    "1933122903": "pvp",
    "1933127933": "pvp",
    "1933132938": "pvp",
    "1933138003": "pvp",
    "1933143017": "raid",
    "1933148022": "raid",
    "1933153032": "pvp",
    "1933158037": "raid",
    "1933163047": "pvp",
    "1933168046": "pvp",
    "1933173056": "pvp",
    "1933178061": "pvp",
    "1933183071": "pvp",
    "1933188076": "pvp",
    "1933193075": "pvp",
    "1933198085": "pvp",
    "1933203090": "pvp",
    "1933208090": "pvp",
    "1933213095": "pvp",
    "1933218099": "pvp",
    "1933223104": "pvp",
    "1933228109": "pvp"
  },
  "Schedule": {
    "enabled": true,
    "useRealtime": false,
    "broadcast": true,
    "entries": [
      "07:00 default Twig Damage is disabled!",
      "20:00 pvp Twig Damage is enabled!"
    ]
  },
  "RuleSets": [
    {
      "name": "default",
      "enabled": true,
      "defaultAllowDamage": false,
      "flags": "AuthorizedDamage, NoHeliDamage, HumanNPCDamage, LockedBoxesImmortal, LockedDoorsImmortal, TrapsIgnorePlayers, TurretsIgnorePlayers, SamSitesIgnorePlayers",
      "rules": [
        "anything can hurt dispensers",
        "anything can hurt players",
        "players cannot hurt players",
        "anything can hurt traps",
        "traps cannot hurt players",
        "players cannot hurt barricades",
        "barricades can hurt players",
        "highwalls can hurt players",
        "anything can hurt heli",
        "anything can hurt npcs",
        "fire cannot hurt players",
        "anything can hurt resources",
        "nothing can hurt vehicles",
        "players cannot hurt vehicles",
        "vehicles cannot hurt players"
      ]
    },
    {
      "name": "pvp",
      "enabled": true,
      "defaultAllowDamage": false,
      "flags": "AuthorizedDamage, NoHeliDamage, HumanNPCDamage, LockedBoxesImmortal, LockedDoorsImmortal, TrapsIgnorePlayers, TurretsIgnorePlayers, TwigDamage",
      "rules": [
        "anything can hurt dispensers",
        "anything can hurt players",
        "players cannot hurt players",
        "anything can hurt traps",
        "traps cannot hurt players",
        "players cannot hurt barricades",
        "barricades can hurt players",
        "highwalls can hurt players",
        "anything can hurt heli",
        "anything can hurt npcs",
        "fire cannot hurt players",
        "anything can hurt resources",
        "anything can hurt vehicles",
        "players can hurt vehicles",
        "vehicles can hurt players"
      ]
    },
    {
      "name": "raid",
      "enabled": true,
      "defaultAllowDamage": true,
      "flags": "HumanNPCDamage",
      "rules": [
        "anything can hurt dispensers",
        "anything can hurt players",
        "players can hurt players",
        "anything can hurt traps",
        "traps can hurt players",
        "players can hurt barricades",
        "barricades can hurt players",
        "highwalls can hurt players",
        "anything can hurt heli",
        "anything can hurt npcs",
        "fire cannot hurt players",
        "anything can hurt resources",
        "anything can hurt vehicles",
        "players can hurt vehicles",
        "vehicles can hurt players"
      ]
    }
  ],
  "Allow Killing Sleepers": false,
  "Entity Groups": [
    {
      "name": "dispensers",
      "members": "BaseCorpse, HelicopterDebris",
      "exclusions": ""
    },
    {
      "name": "players",
      "members": "BasePlayer",
      "exclusions": ""
    },
    {
      "name": "traps",
      "members": "AutoTurret, BearTrap, FlameTurret, Landmine, GunTrap, ReactiveTarget, spikes.floor",
      "exclusions": ""
    },
    {
      "name": "barricades",
      "members": "Barricade",
      "exclusions": ""
    },
    {
      "name": "highwalls",
      "members": "wall.external.high.stone, wall.external.high.wood, gates.external.high.wood, gates.external.high.wood",
      "exclusions": ""
    },
    {
      "name": "heli",
      "members": "BaseHelicopter",
      "exclusions": ""
    },
    {
      "name": "npcs",
      "members": "NPCPlayerApex, BradleyAPC",
      "exclusions": ""
    },
    {
      "name": "fire",
      "members": "FireBall",
      "exclusions": ""
    },
    {
      "name": "resources",
      "members": "ResourceEntity, TreeEntity, OreResourceEntity",
      "exclusions": ""
    },
    {
      "name": "vehicles",
      "members": "_base_car_chassis.entity, 2module_car_spawned.entity, 3module_car_spawned.entity, 4module_car_spawned.entity, car_chassis_2module.entity, car_chassis_3module.entity, car_chassis_4module.entity, 1module_cockpit, 1module_cockpit_armored, 1module_cockpit_with_engine, 1module_engine, 1module_flatbed, 1module_rear_seats, 1module_storage, 2module_flatbed, 2module_fuel_tank, 2module_passengers, randommodular.entity, testridablehorse.prefab, testridablehorse, ridablehorse, rhib, rowboat, hotairballoon, scraptransporthelicopter, minicopter",
      "exclusions": ""
    }
  ]
}​
"BasicCar, ModularCar, BaseModularVehicle, BaseVehicleModule, VehicleModuleEngine, VehicleModuleSeating, VehicleModuleStorage, VehicleModuleTaxi, ModularCarSeat"

should include these members under vehicles. if this doesn't work then wait for the next update :)

Either way I have minicopter and horses also in there and they both take damage also.

then run a tpve.trace on it. that's what its for. it's probably the AuthorizedDamage flag.

I just deleted the plugin and config files and started over and the car/scrap transport copter work now. Mini takes no dmg at all inside or outside a pvp zone and horses take dmg no matter where you are