summaryrefslogtreecommitdiffstats
path: root/Common/Functions/Common_CreateVehicle.sqf
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
commite670b4ed55c459a21090bd0178ceaaaf12d87989 (patch)
treeb6833d5e842475f0ee27f5f617096445fdd4e4a1 /Common/Functions/Common_CreateVehicle.sqf
downloada2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.gz
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.bz2
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.zip
init
Diffstat (limited to '')
-rw-r--r--Common/Functions/Common_CreateVehicle.sqf20
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