Skip to content

Commit b57083a

Browse files
Merge pull request #26 from Alivemonstor/main
Meth Item Checks and Weed
2 parents f556ecd + 03dd5bf commit b57083a

File tree

2 files changed

+47
-25
lines changed

2 files changed

+47
-25
lines changed

client/meth.lua

+39-24
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,24 @@ end)
4848
RegisterNetEvent('ps-drugprocessing:ChangeTemp')
4949
AddEventHandler('ps-drugprocessing:ChangeTemp', function()
5050
if not isTempChangeU then
51-
exports["memorygame"]:thermiteminigame(6, 3, 5, 10,
52-
function() -- success
53-
print("success")
54-
QBCore.Functions.Notify('Temperature Increase Successful', 'success')
55-
ProcessTempUp()
56-
end,
57-
function() -- failure
58-
print("failure")
59-
TriggerServerEvent('ps-drugprocessing:cancelProcessing')
60-
TriggerServerEvent('ps-drugprocessing:processFailUp')
61-
end)
51+
QBCore.Functions.TriggerCallback('QBCore:HasItem', function(result)
52+
if result then
53+
print('You have this item HA')
54+
exports["memorygame"]:thermiteminigame(6, 3, 5, 10,
55+
function() -- success
56+
print("success")
57+
QBCore.Functions.Notify('Temperature Increase Successful', 'success')
58+
ProcessTempUp()
59+
end,
60+
function() -- failure
61+
print("failure")
62+
TriggerServerEvent('ps-drugprocessing:cancelProcessing')
63+
TriggerServerEvent('ps-drugprocessing:processFailUp')
64+
end)
65+
else
66+
QBCore.Functions.Notify('You lack some of the required items - Chemical Mix', 'error')
67+
end
68+
end, 'liquidmix')
6269
else
6370
QBCore.Functions.Notify('Temperature is Already Hot Enough', 'error')
6471
end
@@ -67,22 +74,30 @@ end)
6774
RegisterNetEvent('ps-drugprocessing:ChangeTemp2')
6875
AddEventHandler('ps-drugprocessing:ChangeTemp2', function()
6976
if not isTempChangeD then
70-
exports["memorygame"]:thermiteminigame(6, 3, 5, 10,
71-
function() -- success
72-
print("success")
73-
QBCore.Functions.Notify('Temperature Decrease Successful', 'success')
74-
ProcessTempDown()
75-
end,
76-
function() -- failure
77-
print("failure")
78-
TriggerServerEvent('ps-drugprocessing:cancelProcessing')
79-
TriggerServerEvent('ps-drugprocessing:processFailDown')
80-
end)
77+
QBCore.Functions.TriggerCallback('QBCore:HasItem', function(result)
78+
if result then
79+
print('You have this item HA')
80+
exports["memorygame"]:thermiteminigame(6, 3, 5, 10,
81+
function() -- success
82+
print("success")
83+
QBCore.Functions.Notify('Temperature Decrease Successful', 'success')
84+
ProcessTempUp()
85+
end,
86+
function() -- failure
87+
print("failure")
88+
TriggerServerEvent('ps-drugprocessing:cancelProcessing')
89+
TriggerServerEvent('ps-drugprocessing:processFailDown')
90+
end)
91+
else
92+
QBCore.Functions.Notify('You lack some of the required items - Chemical Vapor', 'error')
93+
end
94+
end, 'chemicalvapor')
8195
else
82-
QBCore.Functions.Notify('Temperature is Already Hot Enough', 'error')
96+
QBCore.Functions.Notify('Temperature is Already Cold Enough', 'error')
8397
end
8498
end)
8599

100+
86101
RegisterNetEvent('ps-drugprocessing:ProcessProduct')
87102
AddEventHandler('ps-drugprocessing:ProcessProduct', function()
88103
local coords = GetEntityCoords(PlayerPedId(source))
@@ -326,4 +341,4 @@ function OpenDoorAnimation()
326341
TaskPlayAnim(ped, "anim@heists@keycard@", "exit", 5.0, 1.0, -1, 16, 0, 0, 0, 0)
327342
Citizen.Wait(400)
328343
ClearPedTasks(ped)
329-
end
344+
end

client/weed.lua

+8-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ end
5353

5454
RegisterNetEvent("ps-drugprocessing:processWeed")
5555
AddEventHandler("ps-drugprocessing:processWeed",function()
56-
ProcessWeed()
56+
QBCore.Functions.TriggerCallback('QBCore:HasItem', function(result)
57+
if result then
58+
print('You have this item HA')
59+
ProcessWeed()
60+
else
61+
QBCore.Functions.Notify("You don't have any cannabis!", 'error')
62+
end
63+
end,'cannabis')
5764
end)
5865

5966
RegisterNetEvent("ps-drugprocessing:pickWeed")

0 commit comments

Comments
 (0)