Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cScripts/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ class cScripts {
// Other
class vehicle_reset {};
class vehicle_addFlagAction {};
class vehicle_planeAutoEject {};
};
class civ {
file = "cScripts\functions\civ";
Expand Down
26 changes: 26 additions & 0 deletions cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "..\script_component.hpp";
/*
* Author: CPL.Brostrom.A
* This function adds a auto ejection system to a vehicle
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Example:
* ["my_jetFighter"] call cScripts_fnc_vehicle_planeAutoEject
*
*/

params [["_vehicle", objNull, [objNull]]];

// Check so the options arent added twice.
if (!isNil {_vehicle GETVAR(QEGVAR(VehicleFunc,AutoEject),nil)}) exitWith {SHOW_WARNING_1("AutoEject", "Aircraft AutoEject already applied for %1.", _vehicle)};

_vehicle addEventHandler ["Hit", {
params ["_vehicle"];
if (damage _vehicle > 0.95) exitWith {
[driver _vehicle, _vehicle] call EFUNC(para,haloJump);
};
}];

_vehicle SETVAR(QEGVAR(VehicleFunc,AutoEject),true);
Loading