-
Notifications
You must be signed in to change notification settings - Fork 1
/
BDL_restoreVehicle.sqf
65 lines (62 loc) · 1.69 KB
/
BDL_restoreVehicle.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
Author: BarboneDiLusso
steam : http://steamcommunity.com/id/barbonedilusso
gitHub : https://github.com/LucaM97/Arma3_BDL_Functions
Description: this script will restore a vehicle which is kind of Car on the platform
i recommend to use it in addaction like a restore base
PS. PLATFORM MUST BE AN OBJECT IN GAME (mission.sqm) LIKE AN HELI PLATFORM
params : platform of rearm - Object
Example:
[platform]call BDL_restoreVehicle;
*/
BDL_limitDistanceForRestoreVehicle = {
_f = false;
_old = _this select 0;
_old_x = _old select 0;
_old_y = _old select 1;
_old_z = _old select 2;
_new = _this select 1;
_new_x = _new select 0;
_new_y = _new select 1;
_new_z = _new select 2;
if ((_new_x - _old_x) < 3) then {
if ((_new_y - _old_y) < 3) then {
if ((_new_z - _old_z) < 3) then {_f = true;};
};
};
_f
};
BDL_restoreVehicle = {
[_this select 0] spawn {
_platform = _this select 0;
_count = 0;
_f = false;
_v = "";
{
if ((_x isKindOf "Car") || (_x isKindOf "Air")) then {
_f = true;
_v = _x;
};
}forEach (_platform nearobjects 5);
if (_f) then {
hint "I will restore your vehicle, please, don't move it";
_old_pos = getpos _v;
while {(_count < 101) && ([_old_pos,getpos _v]call BDL_limitDistanceForRestoreVehicle)} do {
systemchat format ["Restoring Vehicle: %1%2",_count,toString [37]];
sleep 1;
_count = _count + 1;
};
if (_count >= 100) then {
_ammo = weapons _v;
{_v setammo [_x,1000];}foreach _ammo;
_v setfuel 1;
_v setdamage 0;
hint "I have restored your vehicle";
}else {
hint "You moved your vehicle,f*ck you";
};
}else{
hint "Are you kidding me?!?";
};
};
};