-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathlsd.lua
109 lines (89 loc) · 2.94 KB
/
lsd.lua
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
local isPickingUp, isProcessing = false, false
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
if GetDistanceBetweenCoords(coords, Config.CircleZones.lsdProcessing.coords, true) < 5 then
if not isProcessing then
ESX.ShowHelpNotification(_U('lsd_processprompt'))
end
if IsControlJustReleased(0, Keys['E']) and not isProcessing then
if Config.LicenseEnable then
ESX.TriggerServerCallback('esx_license:checkLicense', function(hasProcessingLicense)
if hasProcessingLicense then
Processlsd()
else
OpenBuyLicenseMenu('lsd_processing')
end
end, GetPlayerServerId(PlayerId()), 'lsd_processing')
else
Processlsd()
end
end
else
Citizen.Wait(500)
end
end
end)
function Processlsd()
isProcessing = true
ESX.ShowNotification(_U('lsd_processingstarted'))
TriggerServerEvent('esx_illegal:processLSD')
local timeLeft = Config.Delays.lsdProcessing / 1000
local playerPed = PlayerPedId()
while timeLeft > 0 do
Citizen.Wait(1000)
timeLeft = timeLeft - 1
if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.lsdProcessing.coords, false) > 5 then
ESX.ShowNotification(_U('lsd_processingtoofar'))
TriggerServerEvent('esx_illegal:cancelProcessing')
break
end
end
isProcessing = false
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
if GetDistanceBetweenCoords(coords, Config.CircleZones.thionylchlorideProcessing.coords, true) < 5 then
if not isProcessing then
ESX.ShowHelpNotification(_U('thionylchloride_processprompt'))
end
if IsControlJustReleased(0, Keys['E']) and not isProcessing then
if Config.LicenseEnable then
ESX.TriggerServerCallback('esx_license:checkLicense', function(hasProcessingLicense)
if hasProcessingLicense then
Processthionylchloride()
else
OpenBuyLicenseMenu('thionylchloride_processing')
end
end, GetPlayerServerId(PlayerId()), 'thionylchloride_processing')
else
Processthionylchloride()
end
end
else
Citizen.Wait(500)
end
end
end)
function Processthionylchloride()
isProcessing = true
ESX.ShowNotification(_U('thionylchloride_processingstarted'))
TriggerServerEvent('esx_illegal:processThionylChloride')
local timeLeft = Config.Delays.thionylchlorideProcessing / 1000
local playerPed = PlayerPedId()
while timeLeft > 0 do
Citizen.Wait(1000)
timeLeft = timeLeft - 1
if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.thionylchlorideProcessing.coords, false) > 5 then
ESX.ShowNotification(_U('thionylchloride_processingtoofar'))
TriggerServerEvent('esx_illegal:cancelProcessing')
break
end
end
isProcessing = false
end