diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:38:09 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:38:09 +0300 |
| commit | a3a91d4f45b22fd487ecbc954ad979be5d03efdd (patch) | |
| tree | a554ab159a347dcd6c00ca1c7c26c1ec3ac0a6bd /Common/Functions/Common_CreateVehicle.sqf | |
| download | a2wf_chernarus-main.tar.gz a2wf_chernarus-main.tar.bz2 a2wf_chernarus-main.zip | |
Diffstat (limited to '')
| -rw-r--r-- | Common/Functions/Common_CreateVehicle.sqf | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Common/Functions/Common_CreateVehicle.sqf b/Common/Functions/Common_CreateVehicle.sqf new file mode 100644 index 0000000..b110416 --- /dev/null +++ b/Common/Functions/Common_CreateVehicle.sqf @@ -0,0 +1,20 @@ +Private ["_lock","_position","_side","_type","_vehicle"];
+_type = _this select 0;
+_position = _this select 1;
+_side = _this select 2;
+_lock = _this select 3;
+
+_vehicle = _type createVehicle _position;
+if (_side != resistance) then {
+ _vehicle SetVehicleInit Format["[this,%1] ExecVM 'Common\Common_InitUnit.sqf';",_side];
+ ProcessInitCommands;
+ Call Compile Format ["_vehicle addEventHandler ['Killed',{[_this select 0,_this select 1,%1] Spawn UnitKilled}]",_side];
+} else {
+ //--- Note To be optimized, 1.03 BIS BUG, cannot add resistance side via call compile format? which still isn't fixed in OA 1.59...
+ _vehicle addEventHandler ["Killed",{[_this select 0,_this select 1,resistance] Spawn UnitKilled}];
+};
+_vehicle lock _lock;
+
+diag_log Format["[WFBE (INFORMATION)][frameno:%4 | ticktime:%5] Common_CreateVehicle: A %1 '%2' vehicle has been created (position: %3)",str _side,_type,_position,diag_frameno,diag_tickTime];
+
+_vehicle
\ No newline at end of file |
