-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathonKeyPress.sqf
383 lines (311 loc) · 11.7 KB
/
onKeyPress.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
private ["_handled","_vcls","_vcl","_i","_id","_script","_range","_dirV","_pos","_posFind","_men","_atms","_atm","_firstWhistle","_horn","_key","_shift","_alt","_ctrl"];
_key = _this select 1;
_shift = _this select 2;
_ctrl = _this select 3;
_alt = _this select 4;
_handled = false;
if (isstunned) exitwith {
if(_key == 50)then{_handled = true};
if(_key == 11)then{_handled = true};
_handled
};
switch _key do {
//y key
case 21:
{
if(dialog)exitwith{closeDialog 0;};
if(!INV_shortcuts)exitwith{};
if(chairaction != -1)exitwith{};
_handled=true;
[] execVM "animdlgopen.sqf";
};
//TAB key
case 15: {
if (INV_shortcuts) then {
INV_shortcuts = false;
titletext ["Chaos keys off", "PLAIN DOWN"];
call removeActions;
}else{
INV_shortcuts = true;
titletext["Chaos keys on", "PLAIN DOWN"];
call addActions;
};
};
//L key
case 38: {
if(!INV_shortcuts)exitwith{};
_vcls = nearestobjects [vehicle player, ["LandVehicle", "Air", "ship","Tank"], 7];
if (count _vcls < 1)exitwith{["GC_Vehicle_Bad",["CHAOS LIFE KEY CHAIN","You're not close enough to any vehicle!"]] spawn bis_fnc_showNotification;_handled=true;};
_vcl = _vcls select 0;
if(!(_vcl in INV_VehicleArray))exitwith{["GC_Vehicle_Bad",["CHAOS LIFE KEY CHAIN","You do not have keys to this vehicle!"]] spawn bis_fnc_showNotification;_handled=true;};
["schluessel", _vcl, 0] execVM "keys.sqf";
_handled=true;
};
//T key
case 20: {
if(_shift and chaos) exitWith {[] execVM "\dev\test.sqf"};
if(_ctrl and chaos) exitWith {[] execVM "\dev\test2.sqf"};
if(_alt and chaos) exitWith {[] execVM "\dev\test3.sqf"};
if(chairaction != -1)exitwith{};
if(!INV_shortcuts)exitwith{};
if(dialog)exitwith{closeDialog 0;};
_vcls = nearestobjects [vehicle player, ["LandVehicle", "Air", "ship", "Tank"], 7];
_vcl = _vcls select 0;
//if(!(_vcl in INV_VehicleArray) and typeof _vcl == "TKOrdnanceBox_EP1")exitwith{player groupchat "You do not have the keys to this hideout.";};
if(!(_vcl in INV_VehicleArray))exitwith{["GC_Vehicle_Bad",["CHAOS LIFE KEY CHAIN","You do not have keys to this vehicle!"]] spawn bis_fnc_showNotification;};
if (!isnull _vcl) then {
call compile format['[0,0,0,["%3", "public", ["vcl", "%2", %1]]] execVM "storage.sqf";', _vcl, (typeOf _vcl), format["%1_storage", _vcl]];
};
};
//E key
case 18: {
if(chairaction != -1)exitwith{};
if(isstunned) exitwith{};
if(!INV_shortcuts)exitwith{};
if(keyblock)exitwith{};
if(dialog)exitwith{closeDialog 0;};
if(local_arrest == 1)exitwith{};
private ["_civ"];
for [{_i=1}, {_i < 3}, {_i=_i+1}] do {
if(vehicle player != player) exitwith{};
_range = _i;
_dirV = vectorDir vehicle player;
_pos = player modelToWorld [0,0,0];
_posFind = [(_pos select 0)+(_dirV select 0)*_range,(_pos select 1)+(_dirV select 1)*_range,(_pos select 2)+(_dirV select 2)*_range];
_men = nearestobjects [_posFind,["Man", "B_supplyCrate_F", "Box_NATO_Support_F"], 1] - [player];
_atms = nearestObjects [_posFind,["Man", "Land_CashDesk_F"],2];
_civ = _men select 0;
_atm = _atms select 0;
if(iscop and !(isnull _civ) and _civ in civarray) exitwith {
_i = 4;
call compile format['[0,0,0, ["civmenu", "%1", %1]] execVM "interact.sqf";', _civ];
_handled=true;
};
if(isciv and !(isnull _civ) and _civ in playerarray) exitwith {
_i = 4;
call compile format['[0,0,0, ["civinteraktion", "%1", %1]] execVM "interact.sqf";', _civ];
_handled=true;
};
if(!(isnull _civ) and _civ in shopusearray) exitwith {
_i = 4;
if(iscop and _civ in drugsellarray)exitwith{_civ execVM "drugsearch.sqf"};
_id = _civ call INV_getshopnum;
_id = _id call INV_ItemShopAltStoreNum;
_script = _civ call INV_getItemShopScript;
[0, 0, 0, [_id]] execVM format["%1", _script];
_handled=true;
};
if(!(isnull _atm) and _atm in bankflagarray) exitwith {
_i = 4;
if(!local_useBankPossible)exitwith{playsound"warnsfx";["GC_MoneyBad",["FIRST BANK OF STRATIS","The ATM rejected your card!"]] spawn bis_fnc_showNotification;};
[] execVM "atm.sqf";
_handled=true;
};
};
if(_handled)exitwith{};
if(vehicle player == player) exitwith {
private ["_vcl"];
for [{_i=1}, {_i < 3}, {_i=_i+1}] do {
_range = _i;
_dirV = vectorDir vehicle player;
_pos = player modelToWorld [0,0,0];
_posFind = [(_pos select 0)+(_dirV select 0)*_range,(_pos select 1)+(_dirV select 1)*_range,(_pos select 2)+(_dirV select 2)*_range];
_vcls = nearestobjects [_posFind,["LandVehicle", "Air", "Ship","Tank"], 6];
_vcl = _vcls select 0;
if(!(isnull _vcl))exitwith{_i = 4};
};
if(locked _vcl != 0)exitwith{};
if (_vcl iskindof "UGV_01_base_F") then {
if(_vcl emptyPositions "Cargo" > 0)exitwith {player action ["getInCargo", _vcl]};
} else {
if(_vcl emptyPositions "Driver" > 0)exitwith {player action ["getInDriver", _vcl]};
if(_vcl emptyPositions "Gunner" > 0)exitwith {player action ["getInGunner", _vcl]};
if(_vcl emptyPositions "Commander" > 0)exitwith{player action ["getInCommander", _vcl]};
if(_vcl emptyPositions "Cargo" > 0)exitwith {player action ["getInCargo", _vcl]};
};
};
_vcl = vehicle player;
if(_vcl != player) exitwith {
if(locked _vcl != 0)exitwith{player groupchat "The vehicle is locked."};
if(speed _vcl > 30)exitwith{player groupchat "The vehicle is moving too fast!"};
player action ["getOut", _vcl];
};
};
//F key
case 33: {
if(!INV_shortcuts)exitwith{};
if (!_shift and (player == vehicle player)) then {
if (("flashlight" call INV_getItemAmount) > 0) exitWith {
format ['
if (isNil "%1flashLight") then {
%1flashLight = "#lightpoint" createVehicle (position %1);
%1flashLight setLightAmbient [1, 1, 0.9];
%1flashLight setLightBrightness %2;
%1flashLight lightAttachObject [%1, [0, 4, 0]];
} else {
deleteVehicle %1flashLight;
%1flashLight = nil;
};
', player, flashlightStrength] call broadcast;
_handled=true;
};
};
if(iscop and (vehicle player != player)) then {
[0,0,0,["activate",2]] execVM "siren.sqf";
_handled=true;
};
if(_shift and (vehicle player == player) and call INV_isArmed) then {
if (unholstering) exitWith{player groupChat "Unholstering, please wait..."};
_men = nearestobjects [player, ["Man"], 2] - [player];
_men spawn {
private ["_civ"];
(format ["%1 switchmove ""%2"";", player, "AwopPercMstpSgthWnonDnon_end"]) call broadcast;
sleep 0.2;
if(count _this > 0) then {
_civ = _this select 0;
if(_civ distance player > 2 or !isPlayer _civ)exitwith{};
if ( call GC_PlayerInCrimeFree ) exitWith {
playsound "buzzersfx";
["GC_Bad2",["CHAOS LIFE RULE VIOLATION","You're not allowed to melee in the crime free zone!"]] spawn bis_fnc_showNotification;
};
if(iscop and (call GC_PlayerInCopBase) ) exitWith {
playsound "buzzersfx";
["GC_Bad2",["CHAOS LIFE RULE VIOLATION","You're not allowed to melee in the cop base!"]] spawn bis_fnc_showNotification;
};
(format ["if (player == %1) then {[%2, ""Melee"", 1] spawn onStun;};", _civ, player]) call broadcast;
player groupchat format["You knocked out %1 (%2)!",name _civ,_civ];
};
};
_handled=true;
};
};
//tilde key
case 41: {
if(!INV_shortcuts)exitwith{};
if (_shift) exitWith {
["Settings"] execVM "settings.sqf";
if(dialog)exitwith{closeDialog 0;_handled=true;};
};
};
//1 key
case 2: {
if(!INV_shortcuts)exitwith{};
_handled=true;
if(dialog)exitwith{closeDialog 0;};
[0,0,0,["spielerliste"]] execVM "maindialogs.sqf";
};
//2 key
case 3: {
if(chairaction != -1)exitwith{};
if(!INV_shortcuts)exitwith{};
if(dialog)exitwith{closeDialog 0;_handled=true;};
[0,0,0,["inventory"]] execVM "maindialogs.sqf";
_handled=true;
};
//3 key
case 4: {
if(!INV_shortcuts)exitwith{};
if(chairaction != -1)exitwith{};
if(keyblock or vehicle player != player)exitwith{};
keyblock=true;
[] spawn {sleep 2; keyblock=false;};
_handled=true;
if (animationstate player == "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon") then {
player playmovenow "AmovPercMstpSnonWnonDnon";
} else {
player playmove "TestSurrender";
player playmovenow "AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon";
player playmove "TestSurrender";
};
};
//5 key
case 6: {
if(!INV_shortcuts)exitwith{};
if(dialog)exitwith{closeDialog 0;_handled=true;};
[0,0,0,["gangmenu"]] execVM "maindialogs.sqf";
_handled = true;
};
//6 key
case 7: {
if(!INV_shortcuts)exitwith{};
if(dialog)exitwith{closeDialog 0;_handled=true;};
if (iscop) then {
[0,0,0,["copmenu"]] execVM "maindialogs.sqf";
_handled = true;
};
};
//V
case 47: {
//jump
if (!_shift) exitWith {};
_jaildist = player distance getMarkerPos "jailarea";
if (_jaildist <= 30) exitWith {["GC_Bad2",["JUMP","No jumping in jail!"]] spawn bis_fnc_showNotification;};
[] spawn {
private ["_height","_vel"];
if ((!doingSomething) and (vehicle player == player)) then {
doingSomething = true;
_vel = velocity player;
_height = abs(speed player) / (3.6 / jumpMod);
if (_height > (5.0 * jumpMod)) then {_height = (5.0 * jumpMod)};
player setVelocity [_vel select 0, _vel select 1, (_vel select 2)+_height];
format['%1 switchMove "AovrPercMrunSrasWrflDf";', player] call broadcast;
sleep 1.3;
doingSomething = false;
};
};
/*
_vcl = vehicle player;
if(_vcl getVariable "bunnyhop") then {
[] execVM "gc\client\GC_itemsBunnyhop.sqf";
};
*/
_handled = true;
};
//Semicolon (;)
case 39: {
if(keyblock)exitwith{};
if(call isprone)exitwith{};
if(player call ISSE_IsVictim)exitwith{};
if(chairaction != -1)exitwith{};
if(underwater player) exitWith{};
if (player distance getMarkerPos "jailarea" <= 30) exitWith { playsound "buzzersfx";["GC_Bad2",["CHAOS LIFE RULE VIOLATION","You're not allowed to melee in the crime free zone!"]] spawn bis_fnc_showNotification; };
_firstWhistle = prevWhistles select 0;
if (time > _firstWhistle + 60) then {
if (vehicle player == player) then {
format["%1 switchMove ""AmovPercMstpSnonWnonDnon_SaluteOut"";", player] call broadcast;
};
call compile format['SFXPvEh_%1 = ["%2","whistlesfx",2];',rolenumber,rolestring];
publicVariable format["SFXPvEh_%1", rolenumber];
keyblock=true;
[] spawn {
player say "whistlesfx";
sleep 2;
keyblock=false;
};
for "_i" from 0 to 4 do {
prevWhistles set [_i, prevWhistles select (_i + 1)];
};
prevWhistles set [5, time];
} else {
[] execVM "gc\client\GC_shh.sqf";
};
};
//H Key (Horn)
case 35: {
if ((vehicle player != player) and (driver vehicle player == player)) then {
_horn = vehicle player getvariable "customhorn";
if (!isnil "_horn") then {
call compile format['SFXPvEh_%1 = ["%2","%3",4];',rolenumber,rolestring,_horn];
publicVariable format["SFXPvEh_%1", rolenumber];
keyblock=true;
_horn spawn {
player say _this;
sleep 3;
keyblock=false;
};
_handled=true;
};
};
};
};
_handled;