-
Notifications
You must be signed in to change notification settings - Fork 3
/
defuser.sqf
46 lines (41 loc) · 1.34 KB
/
defuser.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
_art = _this select 0;
if (_art == "use") then {
_item = _this select 1;
_anzahl = _this select 2;
_DefuseBombArray = ["TimeBomb", "Mine", "MineE", "BAF_ied_v1", "BAF_ied_v2", "BAF_ied_v3", "BAF_ied_v4"];
if (isNil "INV_BombDefuserInUse") then {
INV_BombDefuserInUse = false;
};
if (not(INV_BombDefuserInUse)) then {
INV_BombDefuserInUse = true;
if (vehicle player == player) then {
_bombs = [];
{
_bombs = _bombs + (nearestObjects [player, _x, 3] );
} forEach _DefuseBombArray;
if (count _bombs > 0) then {
if (random 100 < 99) then {
player groupChat localize "STRS_inv_items_defuser_success";
deletevehicle (_bombs select 0);
}
else {
player groupChat localize "STRS_inv_items_defuser_failed";
[(position player)] spawn Bomb_Vehicle;
};
}
else {
player groupChat localize "STRS_inv_items_defuser_nobomb";
};
}
else {
for [{_i=0}, {_i < (count INV_ServerBombArray)}, {_i=_i+1}] do {
if (((INV_ServerBombArray select _i) select 1) == (vehicle player)) exitWith {
format["""%1"" call INV_BombDelete", ((INV_ServerBombArray select _i) select 0)] call broadcast;
[player, ((INV_ServerBombArray select _i) select 2), 1] call INV_AddInventoryItem;
player groupChat localize "STRS_inv_items_defuser_success";
};
};
};
INV_BombDefuserInUse = false;
};
};