-
Notifications
You must be signed in to change notification settings - Fork 3
/
moveHQObject.sqf
37 lines (28 loc) · 1.77 KB
/
moveHQObject.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
if (player != stavros) exitWith {hint "Only Player Commander is allowed to move HQ assets"};
_cosa = _this select 0;
_jugador = _this select 1;
_id = _this select 2;
if (!(isNull attachedTo _cosa)) exitWith {hint "The asset you want to move is being moved by another player"};
if (vehicle _jugador != _jugador) exitWith {hint "You cannot move HQ assets while in a vehicle"};
if ({!(isNull _x)} count (attachedObjects _jugador) != 0) exitWith {hint "You have other things attached, you cannot move this"};
_sitios = marcadores select {lados getVariable [_x,sideUnknown] == buenos};
_marcador = [_sitios,_jugador] call BIS_fnc_nearestPosition;
_size = [_marcador] call sizeMarker;
_posicion = getMarkerPos _marcador;
if (_jugador distance2D _posicion > _size) exitWith {hint "This asset needs to be closer to it relative zone center to be able to be moved"};
_cosa removeAction _id;
_cosa attachTo [_jugador,[0,2,1]];
accion = _jugador addAction ["Drop Here", {{detach _x} forEach attachedObjects player; player removeAction accion},nil,0,false,true,"",""];
waitUntil {sleep 1; (count attachedObjects _jugador == 0) or (vehicle _jugador != _jugador) or (_jugador distance2D _posicion > (_size-3)) or !([_jugador] call canFight) or (!isPlayer _jugador)};
{detach _x} forEach attachedObjects _jugador;
player removeAction accion;
/*
for "_i" from 0 to (_jugador addAction ["",""]) do
{
_jugador removeAction _i;
};
*/
_cosa addAction ["Move this asset", "moveHQObject.sqf",nil,0,false,true,"","(_this == stavros)"];
_cosa setPosATL [getPosATL _cosa select 0,getPosATL _cosa select 1,0];
if (vehicle _jugador != _jugador) exitWith {hint "You cannot move HQ assets while in a vehicle"};
if (_jugador distance2D _posicion > _size) exitWith {hint "This asset cannot be moved more far away for its zone center"};