rewrote crack

This commit is contained in:
Mustache Dom committed 2024-10-24 20:19:44 -07:00
1 parent 73af37c00a
commit 1224133815
1 file changed
+29 -36
+29 -36
View File
@@ -1,56 +1,49 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent('md-drugs:server:makecrackone', function(num) RegisterServerEvent('md-drugs:server:makecrackone', function(num)
local src = source local src = source
local Player = QBCore.Functions.GetPlayer(src) local Player = QBCore.Functions.GetPlayer(src)
local count,type, tier = 0, 'cookcrack', 'tier1'
if CheckDist(src, Config.makecrack[num]['loc']) then return end if CheckDist(src, Config.makecrack[num]['loc']) then return end
if Config.TierSystem then if Config.TierSystem then
local locoke = Player.Functions.GetItemByName('loosecoke') local crackTiers = {
local locoke2 = Player.Functions.GetItemByName('loosecokestagetwo') {item = 'loosecoke', tier = 'tier1', log = ' Cut Crack'},
local locoke3 = Player.Functions.GetItemByName('loosecokestagethree') {item = 'loosecokestagetwo', tier = 'tier2', log = ' Cut Crack tier 2'},
if locoke then {item = 'loosecokestagethree', tier = 'tier3', log = ' Cut Crack tier 3'}
if not GetRecipe(src, 'crack', 'cookcrack', 'tier1') then return end }
Log(GetName(src) .. ' Cut Crack', 'crack') for _, v in ipairs(crackTiers) do
elseif locoke2 then if count >= 1 then return end
if not GetRecipe(src, 'crack', 'cookcrack', 'tier2') then return end if Player.Functions.GetItemByName(v.item) then
Log(GetName(src) .. ' Cut Crack', 'crack') tier = v.tier
elseif locoke3 then count = count + 1
if not GetRecipe(src, 'crack', 'cookcrack', 'tier3') then return end Log(GetName(src) .. v.log, 'crack')
Log(GetName(src) .. ' Cut Crack', 'crack')
else
Notifys(src,Lang.Crack.nocoke, 'error')
end end
else
if not GetRecipe(src, 'crack', 'cookcrack', 'tier1') then return end
Log(GetName(src) .. ' Cut Crack', 'crack')
end end
end
if not GetRecipe(src, 'crack', type, tier) then return end
end) end)
RegisterServerEvent('md-drugs:server:bagcrack', function(num) RegisterServerEvent('md-drugs:server:bagcrack', function(num)
local src = source local src = source
local Player = QBCore.Functions.GetPlayer(src) local Player = QBCore.Functions.GetPlayer(src)
if CheckDist(src, Config.bagcrack[num]['loc']) then return end local count,type, tier = 0, 'bagcrack', 'tier1'
if Config.TierSystem then if Config.TierSystem then
local rock = Player.Functions.GetItemByName('crackrock') local crackTiers = {
local rock2 = Player.Functions.GetItemByName('crackrockstagetwo') {item = 'crackrock', tier = 'tier1', log = ' Bagged Crack'},
local rock3 = Player.Functions.GetItemByName('crackrockstagethree') {item = 'crackrockstagetwo', tier = 'tier2', log = ' Bagged Crack tier 2'},
if rock then {item = 'crackrockstagethree', tier = 'tier3', log = ' Bagged Crack tier 3'}
if not GetRecipe(src, 'crack', 'bagcrack', 'tier1') then return end }
Log(GetName(src) .. ' Bagged Crack', 'crack') for _, v in ipairs(crackTiers) do
elseif rock2 then if count >= 1 then return end
if not GetRecipe(src, 'crack', 'bagcrack', 'tier2') then return end if Player.Functions.GetItemByName(v.item) then
Log(GetName(src) .. ' Bagged Crack', 'crack') tier = v.tier
elseif rock3 then count = count + 1
if not GetRecipe(src, 'crack', 'bagcrack', 'tier3') then return end Log(GetName(src) .. v.log, 'crack')
Log(GetName(src) .. ' Bagged Crack', 'crack')
else
Notifys(src, Lang.Crack.nocoke, "error")
end end
else
if not GetRecipe(src, 'crack', 'bagcrack', 'tier1') then return end
Log(GetName(src) .. ' Bagged Crack', 'crack')
end end
end
if not GetRecipe(src, 'crack', type, tier) then return end
end) end)
local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3} local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3}