-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
510 lines (407 loc) · 21.2 KB
/
client.lua
File metadata and controls
510 lines (407 loc) · 21.2 KB
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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
local isBlackout = false -- msk_blackout
AddEventHandler('msk_blackout:powerOn', blackoutPowerOn)
AddEventHandler('msk_blackout:powerOff', blackoutPowerOff)
local startedBlackmoney, successBlackmoneyTeleport = false, false
local printedMoney, printedMoneyEnd, cuttedMoney, countedMoney = false, false, false, false
local printLocations, JobBlips = {}, {}
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
ESX.PlayerData = xPlayer
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
ESX.PlayerData.job = job
end)
CreateThread(function()
if Config.startPoint.blip.enable and isAllowed() then
local blip = AddBlipForCoord(Config.Locations['startWashmoney'].x, Config.Locations['startWashmoney'].y, Config.Locations['startWashmoney'].z)
SetBlipSprite(blip, Config.startPoint.blip.id)
SetBlipScale(blip, Config.startPoint.blip.scale)
SetBlipDisplay(blip, 4)
SetBlipColour(blip, Config.startPoint.blip.color)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName('STRING')
AddTextComponentString(Config.startPoint.blip.label)
EndTextCommandSetBlipName(blip)
end
end)
RegisterNetEvent('msk_blackmoney:startBlackmoney')
AddEventHandler('msk_blackmoney:startBlackmoney', function(coords)
if not coords then return end
local dist = #(GetEntityCoords(PlayerPedId()) - coords)
if dist <= 2.5 and isAllowed() then
startedBlackmoney = true
TriggerEvent("PAC:IgnoreNextNoclipFlag")
blackmoneyTeleport()
end
end)
CreateThread(function()
while true do
local sleep = 200
local playerPed = PlayerPedId()
local dist = #(GetEntityCoords(playerPed) - Config.startPoint.coords)
if dist <= 2.5 and isAllowed() then
sleep = 0
MSK.HelpNotification('~INPUT_CONTEXT~ um den Schwarzgeld Heist zu starten')
if Config.startPoint.marker.enable then
DrawMarker(Config.startPoint.marker.type, Config.startPoint.coords.x, Config.startPoint.coords.y, Config.startPoint.coords.z - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.startPoint.marker.size.a, Config.startPoint.marker.size.b, Config.startPoint.marker.size.c, Config.startPoint.marker.color.a, Config.startPoint.marker.color.b, Config.startPoint.marker.color.c, 100, false, true, 0, false)
end
if IsControlJustPressed(0, Config.Hotkey) then
local blackmoney = MSK.Trigger('msk_blackmoney:getBlackmoney')
if blackmoney and blackmoney.money > 0 then
local hasItem = MSK.HasItem(Config.neededItem)
if hasItem and hasItem.count > 0 then
if Config.SkillCheck.animation.enable then
RequestAnimDict(Config.SkillCheck.animation.dict)
while not HasAnimDictLoaded(Config.SkillCheck.animation.dict) do
Wait(0)
end
TaskPlayAnim(playerPed, Config.SkillCheck.animation.dict, Config.SkillCheck.animation.anim, 8.0, 1.0, -1, 49, 0, false, false, false)
end
local success = lib.skillCheck({Config.SkillCheck.difficulty['1'], Config.SkillCheck.difficulty['2'], {areaSize = 60, speedMultiplier = 2}, Config.SkillCheck.difficulty['3']}, Config.SkillCheck.inputs)
if Config.SkillCheck.animation.enable then
RemoveAnimDict(Config.SkillCheck.animation.dict)
ClearPedTasks(playerPed)
end
if success then
--TriggerServerEvent('msk_blackmoney:getMoneyAfterWashing')
startedBlackmoney = true
blackmoneyTeleport()
end
local random = math.random(1, 100)
if random >= Config.SkillCheck.percent then
TriggerServerEvent('msk_blackmoney:removeItem', Config.neededItem)
end
else
Config.Notification(nil, ('Du benötigst einen %s'):format(hasItem.label))
end
else
Config.Notification(nil, 'Du hast kein Schwarzgeld!')
end
end
end
Wait(sleep)
end
end)
blackmoneyTeleport = function()
local playerPed = PlayerPedId()
TriggerEvent("PAC:IgnoreNextNoclipFlag")
SetEntityCoords(playerPed, Config.Locations['startWashmoney'][1], Config.Locations['startWashmoney'][2], Config.Locations['startWashmoney'][3], false, false, false, true)
SetEntityHeading(playerPed, Config.Locations['startWashmoney'][4])
successBlackmoneyTeleport = true
addPrintLocations()
TriggerServerEvent('msk_blackmoney:notifyJobs')
end
CreateThread(function()
while true do
local sleep = 200
local playerPed = PlayerPedId()
local dist = #(GetEntityCoords(playerPed) - vec3(Config.Locations['startWashmoney'][1], Config.Locations['startWashmoney'][2], Config.Locations['startWashmoney'][3]))
if dist <= 1.5 then
sleep = 0
MSK.HelpNotification('Drücke ~g~E~s~ um das Gebäude zu verlassen')
if IsControlJustPressed(0, Config.Hotkey) then
SetEntityCoords(playerPed, Config.startPoint.coords.x, Config.startPoint.coords.y, Config.startPoint.coords.z, false, false, false, true)
--SetEntityHeading(playerPed, 0.0)
startedBlackmoney = false
successBlackmoneyTeleport = false
end
end
Wait(sleep)
end
end)
CreateThread(function()
while true do
local sleep = 200
if startedBlackmoney and successBlackmoneyTeleport then
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
for k, v in pairs(printLocations) do
local dist = #(playerCoords - v.coords)
if dist <= Config.Locations['wash_money'].distance then
sleep = 0
if Config.Locations['wash_money'].marker.enable then
DrawMarker(Config.Locations['wash_money'].marker.type, v.coords.x, v.coords.y, v.coords.z - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Locations['wash_money'].marker.size.a, Config.Locations['wash_money'].marker.size.b, Config.Locations['wash_money'].marker.size.c, Config.Locations['wash_money'].marker.color.a, Config.Locations['wash_money'].marker.color.b, Config.Locations['wash_money'].marker.color.c, 100, false, true, 0, false)
end
if dist <= 1.0 then
MSK.HelpNotification('Drücke ~g~E~s~ um Geld zu drucken')
if IsControlJustPressed(0, Config.Hotkey) then
local done = false
local dict = 'mini@sprunk' -- 'anim@apt_trans@buzzer'
local anim = 'plyr_buy_drink_pt1' -- 'buzz_reg'
if Config.SkillCheck.animation.enable then
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Wait(0)
end
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, -1, 49, 0, false, false, false)
end
lib.progressBar({duration = v.time * 1000, label = 'Schalte Maschine ein...'})
local timeout = MSK.AddTimeout(v.time * 1000, function()
done = true
if Config.SkillCheck.animation.enable then
RemoveAnimDict(dict)
ClearPedTasks(playerPed)
end
table.remove(printLocations, k)
end)
while not done do
Wait(0)
DisableAllControlActions(0)
EnableControlAction(0, 1, true) -- Camera Movement
EnableControlAction(0, 2, true) -- Camera Movement
EnableControlAction(0, 245, true) -- T
end
end
end
end
end
if printLocations then
if #printLocations == 0 then
startedBlackmoney = false
successBlackmoneyTeleport = false
printedMoney = true
end
end
end
Wait(sleep)
end
end)
CreateThread(function()
while true do
local sleep = 200
if printedMoney then
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local dist = #(playerCoords - Config.Locations['wash_money'].moneyPrintEnd.coords)
if dist <= Config.Locations['wash_money'].distance then
sleep = 0
if Config.Locations['wash_money'].marker.enable then
DrawMarker(Config.Locations['wash_money'].marker.type, Config.Locations['wash_money'].moneyPrintEnd.coords.x, Config.Locations['wash_money'].moneyPrintEnd.coords.y, Config.Locations['wash_money'].moneyPrintEnd.coords.z - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Locations['wash_money'].marker.size.a, Config.Locations['wash_money'].marker.size.b, Config.Locations['wash_money'].marker.size.c, Config.Locations['wash_money'].marker.color.a, Config.Locations['wash_money'].marker.color.b, Config.Locations['wash_money'].marker.color.c, 100, false, true, 0, false)
end
if dist <= 1.0 then
MSK.HelpNotification('Drücke ~g~E~s~ um das Geld zu sammeln')
if IsControlJustPressed(0, Config.Hotkey) then
local done = false
local dict = 'anim@heists@prison_heiststation@cop_reactions'
local anim = 'cop_b_idle'
if Config.SkillCheck.animation.enable then
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Wait(0)
end
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, -1, 49, 0, false, false, false)
end
lib.progressBar({duration = Config.Locations['wash_money'].moneyPrintEnd.time * 1000, label = 'Schalte Maschine ein...'})
local timeout = MSK.AddTimeout(Config.Locations['wash_money'].moneyPrintEnd.time * 1000, function()
done = true
if Config.SkillCheck.animation.enable then
RemoveAnimDict(dict)
ClearPedTasks(playerPed)
end
printedMoney = false
printedMoneyEnd = true
end)
while not done do
Wait(0)
DisableAllControlActions(0)
EnableControlAction(0, 1, true) -- Camera Movement
EnableControlAction(0, 2, true) -- Camera Movement
EnableControlAction(0, 245, true) -- T
end
end
end
end
end
Wait(sleep)
end
end)
CreateThread(function()
while true do
local sleep = 200
if printedMoneyEnd then
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local dist = #(playerCoords - Config.Locations['wash_money'].moneyCut.coords)
if dist <= Config.Locations['wash_money'].distance then
sleep = 0
if Config.Locations['wash_money'].marker.enable then
DrawMarker(Config.Locations['wash_money'].marker.type, Config.Locations['wash_money'].moneyCut.coords.x, Config.Locations['wash_money'].moneyCut.coords.y, Config.Locations['wash_money'].moneyCut.coords.z - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Locations['wash_money'].marker.size.a, Config.Locations['wash_money'].marker.size.b, Config.Locations['wash_money'].marker.size.c, Config.Locations['wash_money'].marker.color.a, Config.Locations['wash_money'].marker.color.b, Config.Locations['wash_money'].marker.color.c, 100, false, true, 0, false)
end
if dist <= 1.0 then
MSK.HelpNotification('Drücke ~g~E~s~ um das Geld zu schneiden')
if IsControlJustPressed(0, Config.Hotkey) then
if Config.SkillCheck.animation.enable then
RequestAnimDict(Config.SkillCheck.animation.dict)
while not HasAnimDictLoaded(Config.SkillCheck.animation.dict) do
Wait(0)
end
TaskPlayAnim(playerPed, Config.SkillCheck.animation.dict, Config.SkillCheck.animation.anim, 8.0, 1.0, -1, 49, 0, false, false, false)
end
local success = lib.skillCheck({Config.SkillCheck.difficulty['1'], Config.SkillCheck.difficulty['2'], {areaSize = 60, speedMultiplier = 2}, Config.SkillCheck.difficulty['3']}, Config.SkillCheck.inputs)
if success then
local done = false
lib.progressBar({duration = Config.Locations['wash_money'].moneyPrintEnd.time * 1000, label = 'Schalte Maschine ein...'})
local timeout = MSK.AddTimeout(Config.Locations['wash_money'].moneyCut.time * 1000, function()
done = true
if Config.SkillCheck.animation.enable then
RemoveAnimDict(dict)
ClearPedTasks(playerPed)
end
printedMoneyEnd = false
cuttedMoney = true
end)
while not done do
Wait(0)
DisableAllControlActions(0)
EnableControlAction(0, 1, true) -- Camera Movement
EnableControlAction(0, 2, true) -- Camera Movement
EnableControlAction(0, 245, true) -- T
end
else
if Config.SkillCheck.animation.enable then
RemoveAnimDict(dict)
ClearPedTasks(playerPed)
end
end
end
end
end
end
Wait(sleep)
end
end)
RegisterNetEvent('msk_blackmoney:skipSkillCheck')
AddEventHandler('msk_blackmoney:skipSkillCheck', function(coords)
if not coords then return end
local dist = #(GetEntityCoords(PlayerPedId()) - coords)
if dist <= 1.0 and isAllowed() then
local done = false
if Config.SkillCheck.animation.enable then
RequestAnimDict(Config.SkillCheck.animation.dict)
while not HasAnimDictLoaded(Config.SkillCheck.animation.dict) do
Wait(0)
end
TaskPlayAnim(playerPed, Config.SkillCheck.animation.dict, Config.SkillCheck.animation.anim, 8.0, 1.0, -1, 49, 0, false, false, false)
end
lib.progressBar({duration = Config.Locations['wash_money'].moneyPrintEnd.time * 1000, label = 'Schalte Maschine ein...'})
local timeout = MSK.AddTimeout(Config.Locations['wash_money'].moneyCut.time * 1000, function()
done = true
if Config.SkillCheck.animation.enable then
RemoveAnimDict(Config.SkillCheck.animation.dict)
ClearPedTasks(playerPed)
end
printedMoneyEnd = false
cuttedMoney = true
end)
while not done do
Wait(0)
DisableAllControlActions(0)
EnableControlAction(0, 1, true) -- Camera Movement
EnableControlAction(0, 2, true) -- Camera Movement
EnableControlAction(0, 245, true) -- T
end
end
end)
CreateThread(function()
while true do
local sleep = 200
if cuttedMoney then
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
local dist = #(playerCoords - Config.Locations['wash_money'].moneyCount.coords)
if dist <= Config.Locations['wash_money'].distance then
sleep = 0
if Config.Locations['wash_money'].marker.enable then
DrawMarker(Config.Locations['wash_money'].marker.type, Config.Locations['wash_money'].moneyCount.coords.x, Config.Locations['wash_money'].moneyCount.coords.y, Config.Locations['wash_money'].moneyCount.coords.z - 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Locations['wash_money'].marker.size.a, Config.Locations['wash_money'].marker.size.b, Config.Locations['wash_money'].marker.size.c, Config.Locations['wash_money'].marker.color.a, Config.Locations['wash_money'].marker.color.b, Config.Locations['wash_money'].marker.color.c, 100, false, true, 0, false)
end
if dist <= 1.0 then
MSK.HelpNotification('Drücke ~g~E~s~ um das Geld zu zählen')
if IsControlJustPressed(0, Config.Hotkey) then
local done = false
if Config.SkillCheck.animation.enable then
RequestAnimDict(Config.SkillCheck.animation.dict)
while not HasAnimDictLoaded(Config.SkillCheck.animation.dict) do
Wait(0)
end
TaskPlayAnim(playerPed, Config.SkillCheck.animation.dict, Config.SkillCheck.animation.anim, 8.0, 1.0, -1, 49, 0, false, false, false)
end
lib.progressBar({duration = Config.Locations['wash_money'].moneyPrintEnd.time * 1000, label = 'Schalte Maschine ein...'})
local timeout = MSK.AddTimeout(Config.Locations['wash_money'].moneyCount.time * 1000, function()
done = true
if Config.SkillCheck.animation.enable then
RemoveAnimDict(Config.SkillCheck.animation.dict)
ClearPedTasks(playerPed)
end
cuttedMoney = false
TriggerServerEvent('msk_blackmoney:getMoneyAfterWashing')
end)
while not done do
Wait(0)
DisableAllControlActions(0)
EnableControlAction(0, 1, true) -- Camera Movement
EnableControlAction(0, 2, true) -- Camera Movement
EnableControlAction(0, 245, true) -- T
end
end
end
end
end
Wait(sleep)
end
end)
RegisterNetEvent('msk_blackmoney:sendJobBlipNotify')
AddEventHandler('msk_blackmoney:sendJobBlipNotify', function()
sendJobBlipNotify()
local timeout = MSK.AddTimeout(Config.notifyJobs.dispatchTime * 60000, function()
sendJobBlipNotify(true)
end)
end)
sendJobBlipNotify = function(notify)
CreateThread(function()
for k, v in pairs(JobBlips) do
RemoveBlip(v)
JobBlips = {}
end
if notify then return end
if isBlackout then return end
if Config.notifyJobs.blip.enable then
local blip = AddBlipForRadius(Config.startPoint.coords.x, Config.startPoint.coords.y, Config.startPoint.coords.z, 50.0)
SetBlipColour(blip, Config.notifyJobs.blip.color)
SetBlipAlpha(blip, 128)
table.insert(JobBlips, blip)
end
end)
end
isAllowed = function()
if not Config.allowed.enable then return true end
for k, v in pairs(Config.allowed.jobs) do
if k == ESX.PlayerData.job.name and v <= ESX.PlayerData.job.grade then
return true
end
end
for k, v in pairs(Config.allowed.character) do
if v == ESX.PlayerData.identifier then
return true
end
end
return false
end
addPrintLocations = function()
printLocations = {}
for k, v in pairs(Config.Locations['wash_money'].printCoords) do
table.insert(printLocations, v)
end
end
blackoutPowerOn = function()
if not Config.MSK_Blackout then return end
isBlackout = false
end
blackoutPowerOff = function()
if not Config.MSK_Blackout then return end
isBlackout = true
end
logging = function(code, ...)
if not Config.Debug then return end
MSK.Logging(code, ...)
end