123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- params[
- ["_vic",objNull,[player]],
- ["_turret_class","",["string"]],
- ["_position_to_attach",[0,0,0],[[]],3]
- ];
-
- if (!canSuspend) exitWith {};
-
- if (isNull _vic) exitWith {};
-
- if (_turret_class isEqualTo '') exitWith {};
- _disable_sim_time=60;
- _time_of_select=time;
-
- waitUntil {
- sleep 0.25;
- ((simulationEnabled _vic) || ((time-_time_of_select)>_disable_sim_time))
- };
-
- if((time-_time_of_select)>_disable_sim_time) exitWith {};
-
- if(count(crew _vic) ==0) exitWith {};
-
- if (!isServer) exitWith {};
-
- sleep 2;
-
-
- if(!(alive _vic)) exitWith{};
-
- _vic allowDamage false;
-
- _created_attached_turret = _turret_class createVehicle (getPosASL _vic);
- _created_attached_turret attachTo [_vic,_position_to_attach];
-
- _created_attached_turret allowDamage false;
-
- createVehicleCrew _created_attached_turret;
- _created_attached_turret hideObjectGlobal true;
-
- [_created_attached_turret] joinSilent _vic;
-
- _current_attached=_vic getVariable ["rd501_attached_gun_object",[]];
- _current_attached pushback _created_attached_turret;
- _vic setVariable ["rd501_attached_gun_object",_current_attached ,true];
-
- [_vic,
- [
- "<t color='#0000FF'>Disable Turret</t>",
- {
- params ["_vic", "_caller", "_actionId", "_arguments"];
- _attached_objectes=attachedObjects _vic;
-
- {
- detach _x;
- deleteVehicle _x;
- } forEach _attached_objectes;
-
- _vic removeAction _actionId;
-
- },
- [],10,true,false,"","true",5, false, "", ""
- ]
- ] remoteExec ["addAction"];
-
-
-
-
- _vic addMPEventHandler ["MPKilled",
- {
- params ["_vic", "_killer", "_instigator", "_useEffects"];
- _attached_objectes=attachedObjects _vic;
-
-
- {
- detach _x;
- deleteVehicle _x;
- } forEach _attached_objectes;
- _vic setVariable ["rd501_attached_gun_object",[],true];
- }];
-
- _vic addEventHandler ["Killed",
- {
- params ["_vic", "_killer", "_instigator", "_useEffects"];
- _attached_objectes=attachedObjects _vic;
-
-
- {
- detach _x;
- deleteVehicle _x;
- } forEach _attached_objectes;
- _vic setVariable ["rd501_attached_gun_object",[],true];
-
- }];
-
-
- [_vic] spawn {
- params["_vic_spawn"];
-
- sleep 2;
-
-
- if(!(alive _vic_spawn)) exitWith{ };
-
- _vic_spawn allowDamage true;
-
-
- _attached_objectes=attachedObjects _vic_spawn;
-
- {
- _x allowDamage true;
- } forEach _attached_objectes;
-
- };
|