From ab49c374959c23b831f905c40c093b41ee57f843 Mon Sep 17 00:00:00 2001 From: ColinM9991 <57466042+ColinM9991@users.noreply.github.com> Date: Fri, 29 Jul 2022 20:26:15 +0100 Subject: [PATCH] Add Killed EH to vehicles (#166) --- addons/cars/README.md | 9 +++++++++ addons/cars/functions/fnc_spawnVehicle.sqf | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/addons/cars/README.md b/addons/cars/README.md index 4c812856..9cb416c8 100644 --- a/addons/cars/README.md +++ b/addons/cars/README.md @@ -29,3 +29,12 @@ private _vehicles = ["C_Van_01_Fuel_F"]; Parameter | Explanation ----------|------------------------------------------------------------- vehicles | Array - All classnames of vehicles that civilians may drive. + + +### Events + +#### grad_civs_cars_vehKilled + +```sqf +["grad_civs_cars_vehKilled", { params ["_deathPos", "_killer", "_vehicle_"]; }] call CBA_fnc_addEventHandler; +``` diff --git a/addons/cars/functions/fnc_spawnVehicle.sqf b/addons/cars/functions/fnc_spawnVehicle.sqf index c8f0652b..aa3bac4f 100644 --- a/addons/cars/functions/fnc_spawnVehicle.sqf +++ b/addons/cars/functions/fnc_spawnVehicle.sqf @@ -23,6 +23,15 @@ _veh addEventHandler [ } ]; + _veh addEventHandler [ + "Killed", + { + params ["_unit", "_killer"]; + + ["grad_civs_cars_vehKilled", [getPos _unit, _killer, _unit]] call CBA_fnc_globalEvent; + } + ]; + private _animalChance = GVAR(animalTransportChance); [_veh, _animalChance] call FUNC(loadAnimals);