-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdelivery.sqf
96 lines (76 loc) · 4.12 KB
/
delivery.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
_art = ((_this select 3) select 0);
if (_art == "getajob_delivery") then {
if (alreadygotaworkplacejob == 1) exitWith {
player groupChat localize "STRS_workplacemission_already";
};
if (canceltime) exitwith {
player groupchat "You cannot start another delivery mission so soon after failing one!";
};
canceltime = false;
alreadygotaworkplacejob = 1;
_whereto = floor(random(count workplacejob_deliveryflagarray));
_msg = workplacejob_deliverymsg select (floor(random(count workplacejob_deliverymsg)));
workplacejob_deliveryflag = workplacejob_deliveryflagarray select (_whereto);
workplacejob_deliveryname = workplacejob_deliverynamearray select (_whereto);
//while {workplacejob_deliveryflag distance player < 1500} do {
// _whereto = floor(random(count workplacejob_deliveryflagarray));
// workplacejob_deliveryflag = workplacejob_deliveryflagarray select (_whereto);
// workplacejob_deliveryname = workplacejob_deliverynamearray select (_whereto);
//};
player groupChat format[localize _msg, workplacejob_deliveryname];
workplacemissioninfos = ["Delivery Mission", format["%1", (_whereto+1)]];
_marker = createMarkerLocal ["deliveryMarker", getPos workplacejob_deliveryflag];
_marker setMarkerShapeLocal "ICON";
"deliveryMarker" setMarkerTypeLocal "mil_warning";
"deliveryMarker" setMarkerColorLocal "ColorYellow";
[player,"GC_Delivery",[_msg,"Reach the delivery point","DELIVERY POINT"],"deliveryMarker",true] call GC_createLocalTask;
timetaken = 0;
_a1 = 0;
_pos = getpos player;
vcl = objnull;
workplacejob_deliverymoney = round(workplacejob_deliveryflag distance _pos)*deliveryjobmulti;
if(workplacejob_deliverymoney > workplacejob_courier_maxmoney)then{workplacejob_deliverymoney = workplacejob_courier_maxmoney};
maxtime = workplacejob_deliverymoney/50;
if(maxtime < deliverymintime)then{maxtime = deliverymintime};
while {true} do {
if (player distance workplacejob_deliveryflag <= 5 and vehicle player == player) exitwith {
["GC_Delivery", "SUCCEEDED"] call BIS_fnc_taskSetState;
player removeaction deliveryinfoaction;
vcl removeaction deliveryinfoaction;
player groupChat format[localize "STRS_workplacemission_delivery_finish", (workplacejob_deliverymoney call ISSE_str_IntToStr)];
hint format["Destination: %1\nTime taken: %2 seconds.\nPay: $%3\nDistance remaining: %4m", workplacejob_deliveryname, timetaken, round workplacejob_deliverymoney, (round(workplacejob_deliveryflag Distance player))];
['cash', round workplacejob_deliverymoney] call INV_AddInventoreItem;
alreadygotaworkplacejob = 0;
workplacemissioninfos = ["", ""];
deleteMarkerLocal "deliveryMarker";
};
if (vehicle player != player and _a1 == 1) then {
vcl = vehicle player;
player removeaction deliveryinfoaction;
deliveryinfoaction = vcl addAction ["Delivery mission info", "gc\client\GC_FNC_noScript.sqf", 'hint format["Destination: %1\nTime remaining: %2 seconds.\nPay: $%3\nDistance remaining: %4m", workplacejob_deliveryname, round(maxtime - timetaken), round workplacejob_deliverymoney, (round(workplacejob_deliveryflag Distance player))]',1,false,true,"",""];
_a1 = 0;
};
if (vehicle player == player and _a1 == 0) then {
vcl removeaction deliveryinfoaction;
deliveryinfoaction = player addAction ["Delivery mission info", "gc\client\GC_FNC_noScript.sqf", 'hint format["Destination: %1\nTime remaining: %2 seconds.\nPay: $%3\nDistance remaining: %4m", workplacejob_deliveryname, round(maxtime - timetaken), round workplacejob_deliverymoney, (round(workplacejob_deliveryflag Distance player))]',1,false,true,"",""];
_a1 = 1;
};
timetaken = timetaken + 1;
if(timetaken > maxtime)exitwith{_art = "cancel"};
if(alreadygotaworkplacejob == 0)exitwith{};
sleep 1;
};
};
if (_art == "cancel") then {
player removeAction deliveryinfoaction;
//player removeAction deliverycancelaction;
vcl removeaction deliveryinfoaction;
player groupchat "delivery mission canceled!";
alreadygotaworkplacejob = 0;
workplacemissioninfos = ["", ""];
deleteMarkerLocal "deliveryMarker";
["GC_Delivery", "CANCELED"] call BIS_fnc_taskSetState;
canceltime=true;
sleep 60;
canceltime=false;
};