made makeMenu function, moved all stores from config to server/travellingmerchant.lua

This commit is contained in:
Mustache Dom committed 2024-10-24 19:45:39 -07:00
1 parent e9f722a140
commit dbed6b3c47
15 files changed
+239 -316

No files matched your search

+3 -45
View File
@@ -1,51 +1,9 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
local isActive = false local isActive = false
RegisterNetEvent('md-drugs:client:opendealermenu', function()
local dealermenu = {}
local rep = GetRep()
print(rep.dealerrep)
if Config.StupidassNewQbItemName then
for k, v in pairs (QBConfig.ProductsStupidNameRewrite) do
if rep.dealerrep >= v.minrep then RegisterNetEvent('md-drugs:client:opendealermenu', function()
dealermenu[#dealermenu + 1] = { local rep = GetRep()
icon = GetImage(v.name), makeMenu('dealermenu', rep)
title = GetLabel(v.name),
description = '$'..v.price,
event = "md-drugs:client:travellingmerchantox",
args = {
item = v.name,
cost = v.price,
amount = v.amount,
table = QBConfig.ProductsStupidNameRewrite,
num = k,
}
}
sorter(dealermenu, 'title')
end
end
else
for k, v in pairs (QBConfig.Products) do
if rep.dealerrep >= v.minrep then
dealermenu[#dealermenu + 1] = {
icon = GetImage(v.name),
title = GetLabel(v.name),
description = '$'..v.price,
event = "md-drugs:client:travellingmerchantox",
args = {
item = v.name,
cost = v.price,
amount = v.amount,
table = QBConfig.Products,
num = k,
}
}
sorter(dealermenu, 'title')
end
end
end
lib.registerContext({id = 'dealermenu',title = "Dealer Menu", options = dealermenu})
lib.showContext('dealermenu') lib.showContext('dealermenu')
end) end)
+30
View File
@@ -218,6 +218,36 @@ function sorter(sorting, value)
table.sort(sorting, function(a, b) print(a[value], b[value]) return a[value] < b[value] end) table.sort(sorting, function(a, b) print(a[value], b[value]) return a[value] < b[value] end)
end end
function makeMenu(name, rep)
local menu = {}
local data = lib.callback.await('md-drugs:server:menu', false, name)
for k, v in pairs (data.table) do
local allow = false
if rep == nil then
allow = true
else
if rep.dealerrep >= v.minrep then allow = true end
end
if allow then
menu[#menu + 1] = {
icon = GetImage(v.name),
description = '$'.. v.price,
title = GetLabel(v.name),
onSelect = function()
local settext = "Cost: $"..v.price
local dialog = exports.ox_lib:inputDialog(v.name .."!", {
{ type = 'select', label = "Payment Type", default = "cash", options = { { value = "cash"}, { value = "bank"},}},
{ type = 'number', label = "Amount to buy", description = settext, min = 0, max = v.amount, default = 1 },
})
if not dialog[1] then return end
TriggerServerEvent("md-drugs:server:purchaseGoods", dialog[2], dialog[1], v.name, v.price, data.table, k)
end,
}
end
end
sorter(menu, 'title')
lib.registerContext({id = data.id, title = data.title, options = menu})
end
function ItemCheck(item) function ItemCheck(item)
+4 -4
View File
@@ -1,9 +1,9 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
local icon = "fas fa-sign-in-alt" local icon = "fa solid fa-eye"
CreateThread(function() CreateThread(function()
AddBoxZoneSingle('telecokein', Config.CokeTeleIn, {action = function()tele(Config.CokeTeleOut)end, icon = icon, label = Lang.targets.coke.enter}) -- coke AddBoxZoneSingle('telecokein', Config.CokeTeleIn, {action = function()tele(Config.CokeTeleOut)end, icon = 'fa-solid fa-door-open', label = Lang.targets.coke.enter}) -- coke
AddBoxZoneSingle('telecokeout', Config.CokeTeleOut, {action = function()tele(Config.CokeTeleIn) end, icon = icon, label = Lang.targets.coke.exits}) -- coke AddBoxZoneSingle('telecokeout', Config.CokeTeleOut, {action = function()tele(Config.CokeTeleIn) end, icon = "fa-solid fa-door-closed", label = Lang.targets.coke.exit}) -- coke
AddBoxZoneMulti('makepowder', Config.MakePowder, {event = "md-drugs:client:makepowder", icon = icon, label = Lang.targets.coke.chop}) -- coke AddBoxZoneMulti('makepowder', Config.MakePowder, {event = "md-drugs:client:makepowder", icon = "fa-solid fa-scissors", label = Lang.targets.coke.chop}) -- coke
AddBoxZoneMulti('steallysergic', Config.lysergicacid, {event = "md-drugs:client:getlysergic", icon = icon, label = Lang.targets.lsd.lys}) -- lsd AddBoxZoneMulti('steallysergic', Config.lysergicacid, {event = "md-drugs:client:getlysergic", icon = icon, label = Lang.targets.lsd.lys}) -- lsd
AddBoxZoneMulti('stealdiethylamide', Config.diethylamide, {event = "md-drugs:client:getdiethylamide", icon = icon, label = Lang.targets.lsd.die}) -- lsd AddBoxZoneMulti('stealdiethylamide', Config.diethylamide, {event = "md-drugs:client:getdiethylamide", icon = icon, label = Lang.targets.lsd.die}) -- lsd
AddBoxZoneMulti('gettabs', Config.gettabs, {event = "md-drugs:client:buytabs", icon = icon, label = Lang.targets.lsd.buyt}) -- lsd AddBoxZoneMulti('gettabs', Config.gettabs, {event = "md-drugs:client:buytabs", icon = icon, label = Lang.targets.lsd.buyt}) -- lsd
+3 -40
View File
@@ -7,46 +7,9 @@ local current = "g_m_y_famdnf_01"
local CurrentLocation = Config.Travellingmerchant[num] local CurrentLocation = Config.Travellingmerchant[num]
local travellingmerchant = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false) local travellingmerchant = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false)
Freeze(travellingmerchant, true, CurrentLocation.w) Freeze(travellingmerchant, true, CurrentLocation.w)
AddSingleModel(travellingmerchant, { label = "Travelling Merchant", icon = "fas fa-eye", AddSingleModel(travellingmerchant, { label = "Travelling Merchant", icon = "fas fa-eye",
action = function() action = function()
local ShopMenu = {} makeMenu('travellingMerchant')
for k, v in pairs (Config.Items.items) do lib.showContext('travellingMerchant')
ShopMenu[#ShopMenu + 1] = {
icon = GetImage(v.name),
description = '$'.. v.price,
title = GetLabel(v.name),
event = "md-drugs:client:travellingmerchantox",
args = {
item = v.name,
cost = v.price,
amount = v.amount,
table = Config.Items.items,
num = k
}
}
sorter(ShopMenu, 'title')
lib.registerContext({id = 'travellingmerchant',title = "Travelling Merchant", options = ShopMenu})
end
lib.showContext('travellingmerchant')
end}, nil) end}, nil)
end) end)
RegisterNetEvent("md-drugs:client:travellingmerchantox", function(data)
local price = data.cost
local settext = "Amnt: "..data.amount.." | Cost: "..price or "Cost: "..price
local max = data.amount
local dialog = exports.ox_lib:inputDialog(data.item .."!", {
{ type = 'select', label = "Payment Type", default = "cash",
options = {
{ value = "cash"},
{ value = "bank"},
}
},
{ type = 'number', label = "Amount to buy", description = settext, min = 0, max = max, default = 1 },
})
if not dialog[1] then return end
if data.cost == "Free" then data.cost = 0 end
TriggerServerEvent("md-drugs:server:travellingmerchantox", dialog[2], dialog[1], data.item, data.cost, data.table, data.num )
end)
+2 -22
View File
@@ -191,32 +191,12 @@ AlienEffect()
end) end)
CreateThread(function() CreateThread(function()
local WeedShop = {} local current = "u_m_m_jesus_01"
local current = "u_m_m_jesus_01"
lib.requestModel(current, Config.RequestModelTime) lib.requestModel(current, Config.RequestModelTime)
local CurrentLocation = Config.WeedSaleman local CurrentLocation = Config.WeedSaleman
local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false) local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false)
Freeze(WeedGuy, true, CurrentLocation.w) Freeze(WeedGuy, true, CurrentLocation.w)
AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye",action = function() lib.showContext('WeedShop')end}, nil) AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye", action = function() makeMenu('WeedShop') lib.showContext('WeedShop')end}, nil)
for k, v in pairs (Config.Weed.items) do
WeedShop[#WeedShop + 1] = {
icon = GetImage(v.name),
title = GetLabel(v.name),
description = '$'.. v.price,
event = "md-drugs:client:travellingmerchantox",
args = {
item = v.name,
cost = v.price,
amount = v.amount,
table = Config.Weed.items,
num = k,
}
}
sorter(WeedShop, 'title')
lib.registerContext({id = 'WeedShop',title = "Weed Shop", options = WeedShop})
end
end) end)
local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName) local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName)
+62 -66
View File
@@ -34,78 +34,74 @@ AddEventHandler("coke:pickupCane", function(loc)
end) end)
RegisterServerEvent('md-drugs:server:makepowder', function(num) RegisterServerEvent('md-drugs:server:makepowder', function(num)
local src = source local src = source
if CheckDist(src, Config.MakePowder[num]['loc']) then return end if CheckDist(src, Config.MakePowder[num]['loc']) then return end
if Config.TierSystem then local tier = 'tier1'
local coke = getRep(src, 'coke') local logMessage = ' Made Raw Coke'
if coke <= Config.Tier1 then if Config.TierSystem then
if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier1') then return end local coke = getRep(src, 'coke')
Log(GetName(src) .. ' Made Raw Coke' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke') if coke > Config.Tier1 and coke <= Config.Tier2 then
elseif coke >= Config.Tier1 and coke <= Config.Tier2 then tier = 'tier2'
if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier2') then return end logMessage = ' Made Raw Coke tier 2'
Log(GetName(src) .. ' Made Raw Coke tier 2' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke') elseif coke > Config.Tier2 then
else tier = 'tier3'
if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier3') then return end logMessage = ' Made Raw Coke tier 3'
Log(GetName(src) ..' Made Raw Coke tier 3' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke') end
end end
else if not GetRecipe(src, 'cocaine', 'cokepowder', tier) then return end
if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier1') then return end Log(GetName(src) .. logMessage .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
Log(GetName(src) .. ' Made Raw Coke' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke')
end
end) end)
RegisterServerEvent('md-drugs:server:cutcokeone', function() RegisterServerEvent('md-drugs:server:cutcokeone', function()
local src = source local src = source
local Player = QBCore.Functions.GetPlayer(src) local Player = QBCore.Functions.GetPlayer(src)
if Config.TierSystem then local count = 0
local coke = Player.Functions.GetItemByName('coke') if Config.TierSystem then
local coke2 = Player.Functions.GetItemByName('cokestagetwo') local cokeTiers = {
local coke3 = Player.Functions.GetItemByName('cokestagethree') {item = 'coke', tier = 'tier1', log = ' Cut Coke'},
if coke then {item = 'cokestagetwo', tier = 'tier2', log = ' Cut Coke tier 2'},
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end {item = 'cokestagethree', tier = 'tier3', log = ' Cut Coke tier 3'}
Log(GetName(src) .. ' Cut Coke', 'coke') }
elseif coke2 then for _, v in ipairs(cokeTiers) do
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier2') then return end if count >= 1 then return end
Log(GetName(src) .. ' Cut Coke tier 2', 'coke') if Player.Functions.GetItemByName(v.item) then
elseif coke3 then if not GetRecipe(src, 'cocaine', 'cutcoke', v.tier) then return end
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier3') then return end Log(GetName(src) .. v.log, 'coke')
Log(GetName(src) .. ' Cut Coke tier 3', 'coke') return
else end
Notifys(src,Lang.Coke.nocutcoke, "error") end
end Notifys(src, Lang.Coke.nocutcoke, "error")
else else
if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end
Log(GetName(src) .. ' Cut Coke', 'coke') Log(GetName(src) .. ' Cut Coke', 'coke')
end end
end) end)
RegisterServerEvent('md-drugs:server:bagcoke', function() RegisterServerEvent('md-drugs:server:bagcoke', function()
local src = source local src = source
local Player = QBCore.Functions.GetPlayer(src) local Player = QBCore.Functions.GetPlayer(src)
if Config.TierSystem then local count = 0
local coke = getRep(source, 'coke') if Config.TierSystem then
local locoke = Player.Functions.GetItemByName('loosecoke') local coke = getRep(src, 'coke')
local locoke2 = Player.Functions.GetItemByName('loosecokestagetwo') local cokeTiers = {
local locoke3 = Player.Functions.GetItemByName('loosecokestagethree') {item = 'loosecoke', tier = 'tier1', log = ' Bagged Coke'},
if locoke then {item = 'loosecokestagetwo', tier = 'tier2', log = ' Bagged Coke tier 2'},
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end {item = 'loosecokestagethree', tier = 'tier3', log = ' Bagged Coke tier 3'}
AddRep(src, 'coke') }
Log(GetName(src) .. ' Bagged Coke and now has a rep of ' .. coke + 1, 'coke') for _, v in ipairs(cokeTiers) do
elseif locoke2 then if Player.Functions.GetItemByName(v.item) then
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end if count >= 1 then return end
AddRep(src, 'coke') if not GetRecipe(src, 'cocaine', 'bagcoke', v.tier) then return end
Log(GetName(src) .. ' Bagged Coke tier 2 and now has a rep of ' .. coke + 1, 'coke') AddRep(src, 'coke')
elseif locoke3 then Log(GetName(src) .. v.log .. ' and now has a rep of ' .. coke + 1, 'coke')
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier3') then return end return
AddRep(src, 'coke') end
Log(GetName(source) .. ' Bagged Coke tier 3 and now has a rep of ' .. coke + 1, 'coke') end
else Notifys(src, Lang.Coke.nobagcoke, "error")
Notifys(src, Lang.Coke.nobagcoke, "error") else
end if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end
else Log(GetName(src) .. ' Bagged Coke', 'coke')
if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end end
Log(GetName(source) .. ' Bagged Coke', 'coke')
end
end) end)
local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3} local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3}
+10 -11
View File
@@ -1,15 +1,15 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
for k, v in pairs (Consumables.Items) do QBCore.Functions.CreateUseableItem(k, function(source, item) for k, v in pairs(Consumables.Items) do
local src = source QBCore.Functions.CreateUseableItem(k, function(source, item)
local Player = QBCore.Functions.GetPlayer(src) if not Itemcheck(source, k, 1) then return end
if v.time == nil then v.time = Consumables.defaulttime end local time = v.time or Consumables.defaulttime
if v.effect == nil then v.effect = 0 end local effect = v.effect or 0
if v.anim == nil then v.anim = Consumables.defaultanim end local anim = v.anim or Consumables.defaultanim
if v.progressbartext == nil then v.progressbartext = Consumables.defaultprogresstext end local progressbartext = v.progressbartext or Consumables.defaultprogresstext
if v.add == nil then v.add = {hunger = 0} end local add = v.add or {hunger = 0}
TriggerClientEvent("md-drugs:client:consumedrugs", source, v.time, v.effect, v.anim, v.progressbartext, v.add, k) TriggerClientEvent("md-drugs:client:consumedrugs", source, time, effect, anim, progressbartext, add, k)
end) end)
end end
RegisterNetEvent('md-drugs:server:removeconsum', function(item) RegisterNetEvent('md-drugs:server:removeconsum', function(item)
@@ -18,7 +18,6 @@ RegisterNetEvent('md-drugs:server:removeconsum', function(item)
end) end)
RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval) RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval)
print(stat,statval)
local Player = QBCore.Functions.GetPlayer(source) local Player = QBCore.Functions.GetPlayer(source)
if stat == "thirst" then if stat == "thirst" then
local value = Player.PlayerData.metadata.thirst + statval local value = Player.PlayerData.metadata.thirst + statval
+6 -1
View File
@@ -261,7 +261,12 @@ function AddRep(source, type)
MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, Player.PlayerData.citizenid}) MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, Player.PlayerData.citizenid})
return true return true
end end
function sortTab(tbl, type)
table.sort(tbl, function(a, b)
return a[type] < b[type]
end)
end
function ChecknRemove(source, table) function ChecknRemove(source, table)
local Player = QBCore.Functions.GetPlayer(source) local Player = QBCore.Functions.GetPlayer(source)
-1
View File
@@ -19,7 +19,6 @@ end)
QBCore.Functions.CreateUseableItem('leancup', function(source, item) QBCore.Functions.CreateUseableItem('leancup', function(source, item)
local src = source local src = source
local Player = QBCore.Functions.GetPlayer(src)
if Itemcheck(src, 'leancup', 1) then if Itemcheck(src, 'leancup', 1) then
TriggerClientEvent('md-drugs:client:leancraft', src) TriggerClientEvent('md-drugs:client:leancraft', src)
end end
+27 -41
View File
@@ -9,8 +9,7 @@ RegisterServerEvent('md-drugs:server:getlysergic', function(num)
end) end)
RegisterServerEvent('md-drugs:server:getdiethylamide', function(num) RegisterServerEvent('md-drugs:server:getdiethylamide', function(num)
local src = source local src = source
local Player = QBCore.Functions.GetPlayer(src)
if CheckDist(src, Config.diethylamide[num]['loc']) then return end if CheckDist(src, Config.diethylamide[num]['loc']) then return end
if AddItem(src,'diethylamide', 2) then if AddItem(src,'diethylamide', 2) then
Log(GetName(src) ..' Got Diethylamide with a distance of ' .. dist(source, Config.diethylamide[num]['loc']) .. '!', 'lsd') Log(GetName(src) ..' Got Diethylamide with a distance of ' .. dist(source, Config.diethylamide[num]['loc']) .. '!', 'lsd')
@@ -28,7 +27,7 @@ end)
lib.callback.register('md-drugs:server:removecleaningkit', function(source) lib.callback.register('md-drugs:server:removecleaningkit', function(source)
local src = source local src = source
if not Itemcheck(src, 'cleaningkit', 1) then return end if not Itemcheck(src, 'cleaningkit', 1) then return end
if RemoveItem(src,"cleaningkit", 1) then if RemoveItem(src,"cleaningkit", 1) then
Log(GetName(src) ..' Wiped Down Their LSD Lab Kit!' , 'lsd') Log(GetName(src) ..' Wiped Down Their LSD Lab Kit!' , 'lsd')
@@ -37,21 +36,21 @@ local src = source
end) end)
RegisterServerEvent('md-drugs:server:getlabkitback', function() RegisterServerEvent('md-drugs:server:getlabkitback', function()
local src = source local src = source
if AddItem(src,"lsdlabkit", 1) then if AddItem(src,"lsdlabkit", 1) then
Log(GetName(src) ..' Picked Up Their LSD Lab Kit Back At ' .. GetCoords(src) .. '!', 'lsd') Log(GetName(src) ..' Picked Up Their LSD Lab Kit Back At ' .. GetCoords(src) .. '!', 'lsd')
end end
end) end)
RegisterServerEvent('md-drugs:server:heatliquid', function() RegisterServerEvent('md-drugs:server:heatliquid', function()
local src = source local src = source
if not GetRecipe(src, 'lsd', 'vial', 'heat') then return end if not GetRecipe(src, 'lsd', 'vial', 'heat') then return end
Log(GetName(src) ..' Heated Basic LSD!', 'lsd') Log(GetName(src) ..' Heated Basic LSD!', 'lsd')
end) end)
RegisterServerEvent('md-drugs:server:failheating', function() RegisterServerEvent('md-drugs:server:failheating', function()
local src = source local src = source
if not ChecknRemove(source, {lysergic_acid = 1, diethylamide = 1}) then return end if not ChecknRemove(source, {lysergic_acid = 1, diethylamide = 1}) then return end
Notifys(src,Lang.lsd.failed, "error") Notifys(src,Lang.lsd.failed, "error")
Log(GetName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd') Log(GetName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd')
end) end)
@@ -59,7 +58,6 @@ end)
RegisterServerEvent('md-drugs:server:refinequalityacid', function() RegisterServerEvent('md-drugs:server:refinequalityacid', function()
local src = source local src = source
local randomchance = math.random(1,100)
if not Itemcheck(src, 'lsd_one_vial', 1) then return end if not Itemcheck(src, 'lsd_one_vial', 1) then return end
if Config.TierSystem then if Config.TierSystem then
local lsd = getRep(src, 'lsd') local lsd = getRep(src, 'lsd')
@@ -79,6 +77,7 @@ if not Itemcheck(src, 'lsd_one_vial', 1) then return end
Log(GetName(src) ..' Refined Acid and Now Has A Rep Of ' .. lsd + 1 .. '!', 'lsd') Log(GetName(src) ..' Refined Acid and Now Has A Rep Of ' .. lsd + 1 .. '!', 'lsd')
end end
else else
local randomchance = math.random(1,100)
if RemoveItem(src,'lsd_one_vial', 1) then if RemoveItem(src,'lsd_one_vial', 1) then
if randomchance <= 60 then if randomchance <= 60 then
AddItem(src,'lsd_vial_two', 1) AddItem(src,'lsd_vial_two', 1)
@@ -127,44 +126,31 @@ RegisterServerEvent('md-drugs:server:getlabkit', function()
end end
end) end)
RegisterServerEvent('md-drugs:server:maketabpaper', function() RegisterServerEvent('md-drugs:server:maketabpaper', function()
local src = source local src = source
local Player = QBCore.Functions.GetPlayer(src) if not Itemcheck(src,'tab_paper', 1) then return end
if not Itemcheck(src,'tab_paper', 1) then return end local count = 0
if RemoveItem(src,'lsd_one_vial', 1) then local vialdata = {
RemoveItem(src,'tab_paper', 1) {vial = 'lsd_one_vial', sheet = 'smileyfacesheet', log = 'Made A Smiley Face Sheet'},
AddItem(src,'smileyfacesheet', 1) {vial = 'lsd_vial_two', sheet = 'wildcherrysheet', log = 'Made A Wild Cherry Sheet'},
Log(GetName(src) ..' Made A Smiley Face Sheet', 'lsd') {vial = 'lsd_vial_three', sheet = 'yinyangsheet', log = 'Made A Yin Yang Sheet'},
elseif Player.Functions.RemoveItem('lsd_vial_two', 1) then {vial = 'lsd_vial_four', sheet = 'pineapplesheet', log = 'Made A Pine Apple Sheet'},
RemoveItem(src,'tab_paper', 1) {vial = 'lsd_vial_five', sheet = 'bartsheet', log = 'Made A Cluckin Bell Sheet'},
AddItem(src,'wildcherrysheet', 1) {vial = 'lsd_vial_six', sheet = 'gratefuldeadsheet', log = 'Made A Maze Sheet'}
Log(GetName(src) ..' Made A Wild Cherry Sheet', 'lsd') }
elseif Player.Functions.RemoveItem('lsd_vial_three', 1) then sortTab(vialdata, 'vial')
RemoveItem(src,'tab_paper', 1) for k, v in pairs (vialdata) do
AddItem(src,'yinyangsheet', 1) if count >= 1 then return end
Log(GetName(src) ..' Made A Yin Yang Sheet', 'lsd') if RemoveItem(src, v.vial, 1) and RemoveItem(src, 'tab_paper', 1) then
elseif Player.Functions.RemoveItem('lsd_vial_four', 1) then AddItem(src, v.sheet, 1)
RemoveItem(src,'tab_paper', 1) Log(GetName(src) ..' ' .. v.log, 'lsd')
AddItem(src,'pineapplesheet', 1) count = count + 1
Log(GetName(src) ..' Made A Pine Apple Sheet', 'lsd') end
elseif Player.Functions.RemoveItem('lsd_vial_five', 1) then
RemoveItem(src,'tab_paper', 1)
AddItem(src,'bartsheet', 1)
Log(GetName(src) ..' Made A Cluckin Bell Sheet', 'lsd')
elseif Player.Functions.RemoveItem('lsd_vial_six', 1) then
RemoveItem(src,'tab_paper', 1)
AddItem(src,'gratefuldeadsheet', 1)
Log(GetName(src) ..' Made A Maze Sheet', 'lsd')
else
Notifys(Lang.lsd.novial, "error")
end end
end) end)
local sheets = { local sheets = {
{item = 'smileyfacesheet', recieve = "Smiley_tabs", }, {item = 'smileyfacesheet', recieve = "smiley_tabs", },
{item = 'wildcherrysheet', recieve = "wildcherry_tabs", }, {item = 'wildcherrysheet', recieve = "wildcherry_tabs", },
{item = 'yinyangsheet', recieve = "yinyang_tabs", }, {item = 'yinyangsheet', recieve = "yinyang_tabs", },
{item = 'pineapplesheet', recieve = "pineapple_tabs", }, {item = 'pineapplesheet', recieve = "pineapple_tabs", },
+1 -3
View File
@@ -1,14 +1,12 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
GlobalState.Mescaline = Config.Mescaline GlobalState.Mescaline = Config.Mescaline
Citizen.CreateThread(function() Citizen.CreateThread(function()
for _, v in pairs(Config.Mescaline) do for _, v in pairs(Config.Mescaline) do
v.taken = false v.taken = false
end end
end) end)
function MescalineCooldown(loc) function MescalineCooldown(loc)
CreateThread(function() CreateThread(function()
Wait(Config.respawnTime * 1000) Wait(Config.respawnTime * 1000)
@@ -22,7 +20,7 @@ end
RegisterNetEvent("Mescaline:pickupCane", function(loc) RegisterNetEvent("Mescaline:pickupCane", function(loc)
if CheckDist(source, Config.Mescaline[loc].location) then return end if CheckDist(source, Config.Mescaline[loc].location) then return end
if not Config.Mescaline[loc].taken then if not Config.Mescaline[loc].taken then
Config.Mescaline[loc].taken = true Config.Mescaline[loc].taken = true
GlobalState.Mescaline = Config.Mescaline GlobalState.Mescaline = Config.Mescaline
+12 -12
View File
@@ -1,14 +1,14 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
RegisterServerEvent('md-drugs:server:startcook', function() RegisterServerEvent('md-drugs:server:startcook', function()
local src = source local src = source
if not GetRecipe(source, 'meth', 'cook', 'heat') then return end if not GetRecipe(source, 'meth', 'cook', 'heat') then return end
Notifys(src, "Adding Things To The Mix", "success") Notifys(src, "Adding Things To The Mix", "success")
Log(GetName(source) .. ' Started A Meth Batch', 'Meth') Log(GetName(source) .. ' Started A Meth Batch', 'Meth')
end) end)
RegisterServerEvent('md-drugs:server:givemethingridients', function() RegisterServerEvent('md-drugs:server:givemethingridients', function()
local src = source local src = source
local chance = math.random(1,100) local chance = math.random(1,100)
local amount = math.random(1,5) local amount = math.random(1,5)
if chance <= 50 then if chance <= 50 then
@@ -30,18 +30,18 @@ end)
RegisterServerEvent('md-drugs:server:geteph', function(num) RegisterServerEvent('md-drugs:server:geteph', function(num)
local src = source local src = source
if CheckDist(src, Config.MethEph[num]['loc']) then return end if CheckDist(src, Config.MethEph[num]['loc']) then return end
if AddItem(src, 'ephedrine', 1) then if AddItem(src, 'ephedrine', 1) then
Notifys(src, 'Got Ephedrine!', "success") Notifys(src, 'Got Ephedrine!', "success")
Log(GetName(src) .. ' Got ' .. 1 .. 'Of Ephedrine', 'Meth') Log(GetName(src) .. ' Got ' .. 1 .. 'Of Ephedrine', 'Meth')
end end
end) end)
RegisterServerEvent('md-drugs:server:getace', function(num) RegisterServerEvent('md-drugs:server:getace', function(num)
local src = source local src = source
if CheckDist(src, Config.Methace[num]['loc']) then return end if CheckDist(src, Config.Methace[num]['loc']) then return end
if AddItem(src, 'acetone', 1) then if AddItem(src, 'acetone', 1) then
Log(GetName(src) .. ' Got ' .. 1 .. 'Of Acetone', 'Meth') Log(GetName(src) .. ' Got ' .. 1 .. 'Of Acetone', 'Meth')
Notifys(src, 'Got Acetone!', "success") Notifys(src, 'Got Acetone!', "success")
end end
end) end)
+77 -8
View File
@@ -1,15 +1,84 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
local loc = math.random(1, #Config.Travellingmerchant) local loc = math.random(1, #Config.Travellingmerchant)
RegisterServerEvent("md-drugs:server:travellingmerchantox", function(amount, money, item, price,table,num) local stores = {
local src = source local Player = QBCore.Functions.GetPlayer(src) travel = {
if not table[num]['name'] == item then return end {name = "tab_paper", price = 50, amount = 50, },
if Player.Functions.RemoveMoney(tostring(money), tonumber(price) * tonumber(amount)) then {name = "bakingsoda", price = 25, amount = 50, },
AddItem(source, item, amount) {name = "isosafrole", price = 25, amount = 50, },
Log(GetName(source) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant') {name = "mdp2p", price = 25, amount = 50, },
end {name = "lysergic_acid", price = 25, amount = 50, },
{name = "diethylamide", price = 25, amount = 50, },
{name = "lockpick", price = 2, amount = 1000, },
{name = "emptyvial", price = 2, amount = 1000, },
{name = "needle", price = 2, amount = 1000, },
{name = "cokeburner", price = 25, amount = 50, },
{name = "crackburner", price = 2, amount = 50, },
{name = "lsdburner", price = 2, amount = 50, },
{name = "heroinburner", price = 2, amount = 50, },
{name = "mdlean", price = 50, amount = 50, },
{name = "weedgrinder", price = 25, amount = 50, },
{name = "mdbutter", price = 25, amount = 50, },
{name = "flour", price = 25, amount = 50, },
{name = "chocolate", price = 25, amount = 50, },
{name = "butane", price = 25, amount = 50, },
{name = "butanetorch", price = 2, amount = 1000, },
{name = "dabrig", price = 2, amount = 1000, },
{name = "mdwoods", price = 2, amount = 1000, },
{name = "leancup", price = 25, amount = 50, },
{name = "xtcburner", price = 25, amount = 50, },
},
Weed = {
{name = "weedgrinder", price = 25, amount = 50, },
{name = "mdbutter", price = 25, amount = 50, },
{name = "flour", price = 25, amount = 50, },
{name = "chocolate", price = 25, amount = 50, },
{name = "butane", price = 25, amount = 50, },
{name = "butanetorch", price = 2, amount = 1000,},
{name = "dabrig", price = 2, amount = 1000,},
{name = "mdwoods", price = 2, amount = 1000},
},
Products = {
{name = "weed_white-widow_seed", price = 15, amount = 150, minrep = 0},
{name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0},
{name = "weed_purple-haze_seed", price = 15, amount = 150, minrep = 0},
{name = "weed_og-kush_seed", price = 15, amount = 150, minrep = 0},
{name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0},
},
ProductsStupidNameRewrite = {
{name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0},
{name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0},
{name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0},
{name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0},
{name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0},
}
}
lib.callback.register('md-drugs:server:menu', function(source, data)
local src = source
if data == 'travellingMerchant' then
return {table = stores.travel, des = '$', id = 'travellingMerchant', title = 'travelling Merchant'}
elseif data == 'dealermenu' then
local table
if Config.StupidassNewQbItemName then table = stores.ProductsStupidNameRewrite else table = stores.Products end
return {table = table, id = 'dealermenu', title = "Dealer Menu"}
elseif data == 'WeedShop' then
return {table = stores.Weed, id = 'WeedShop', title = "Weed Shop"}
end
end)
RegisterServerEvent("md-drugs:server:purchaseGoods", function(amount, money, item, price,table,num)
local src = source local Player = QBCore.Functions.GetPlayer(src)
for i = 1, #table do
if table[i].name == item then
if not table[i].price == price then return end
if Player.Functions.RemoveMoney(tostring(money), tonumber(table[i].price) * tonumber(amount)) then
AddItem(src, item, amount)
Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant')
end
end
end
end) end)
lib.callback.register('md-drugs:server:GetMerchant', function(source) lib.callback.register('md-drugs:server:GetMerchant', function(source)
return loc return loc
end) end)
+1 -43
View File
@@ -158,20 +158,6 @@ Config.WeedDry = { -- where you dry leaves
Config.Joblock = false -- if you want weed to be a job Config.Joblock = false -- if you want weed to be a job
Config.weedjob = "" -- what the job name is Config.weedjob = "" -- what the job name is
Config.Weed = { --- this is the store for the weed ingridients
label = "Weed Shop",
slots = 8,
items = {
{name = "weedgrinder", price = 25, amount = 50, },
{name = "mdbutter", price = 25, amount = 50, },
{name = "flour", price = 25, amount = 50, },
{name = "chocolate", price = 25, amount = 50, },
{name = "butane", price = 25, amount = 50, },
{name = "butanetorch", price = 2, amount = 1000,},
{name = "dabrig", price = 2, amount = 1000,},
{name = "mdwoods", price = 2, amount = 1000,},
}
}
----------------- Wholesale ----------------- Wholesale
Config.SuccessfulChance = 90 --- this is the chance of a Success wholesale 1-100 Config.SuccessfulChance = 90 --- this is the chance of a Success wholesale 1-100
@@ -191,35 +177,7 @@ Config.Travellingmerchant = { ------------ these are the random locations the me
vector4(-1522.93, 1476.01, 111.45, 41.25), vector4(-1522.93, 1476.01, 111.45, 41.25),
vector4(-3278.98, 973.38, 5.35, 101.53), vector4(-3278.98, 973.38, 5.35, 101.53),
} }
Config.Items = { --- this is the store for the travelling merchant
items = {
{name = "tab_paper", price = 50, amount = 50,},
{name = "bakingsoda", price = 25, amount = 50, },
{name = "isosafrole", price = 25, amount = 50, },
{name = "mdp2p", price = 25, amount = 50, },
{name = "lysergic_acid", price = 25, amount = 50, },
{name = "diethylamide", price = 25, amount = 50, },
{name = "lockpick", price = 2, amount = 1000, },
{name = "emptyvial", price = 2, amount = 1000, },
{name = "needle", price = 2, amount = 1000, },
{name = "cokeburner", price = 25, amount = 50, },
{name = "crackburner", price = 2, amount = 50, },
{name = "lsdburner", price = 2, amount = 50, },
{name = "heroinburner", price = 2, amount = 50, },
{name = "mdlean", price = 50, amount = 50, },
{name = "weedgrinder", price = 25, amount = 50, },
{name = "mdbutter", price = 25, amount = 50, },
{name = "flour", price = 25, amount = 50, },
{name = "chocolate", price = 25, amount = 50, },
{name = "butane", price = 25, amount = 50, },
{name = "butanetorch", price = 2, amount = 1000, },
{name = "dabrig", price = 2, amount = 1000, },
{name = "mdwoods", price = 2, amount = 1000, },
{name = "leancup", price = 25, amount = 50, },
{name = "xtcburner", price = 25, amount = 50, },
}
}
--------------------------------------- oxy runs --------------------------------------- oxy runs
---- How oxyruns work. You pay for a truck, you get in it and it gives a route. There is a 20% chance that the car will be "hot" and you have to ditch it. No Routes will spawn if that pops up ---- How oxyruns work. You pay for a truck, you get in it and it gives a route. There is a 20% chance that the car will be "hot" and you have to ditch it. No Routes will spawn if that pops up
----- when you get to the drop off point third eye the truck. You will carry a box to the ped. He will give you cash, some oxy and maybe a random item. Rinse and repeat ----- when you get to the drop off point third eye the truck. You will carry a box to the ped. He will give you cash, some oxy and maybe a random item. Rinse and repeat
+1 -19
View File
@@ -140,25 +140,7 @@ QBConfig.DrugsPrice = {
["cupofdextro"] = {min = 18, max = 40}, ["cupofdextro"] = {min = 18, max = 40},
} }
QBConfig.Dealers = {} QBConfig.Dealers = {}
-- Shop QBConfig
QBConfig.Products = {
[1] = {name = "weed_white-widow_seed", price = 15, amount = 150, minrep = 0},
[2] = {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0},
[3] = {name = "weed_purple-haze_seed", price = 15, amount = 150, minrep = 0},
[4] = {name = "weed_og-kush_seed", price = 15, amount = 150, minrep = 0},
[5] = {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0},
}
QBConfig.ProductsStupidNameRewrite = {
[1] = {name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0},
[2] = {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0},
[3] = {name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0},
[4] = {name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0},
[5] = {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0},
}
QBConfig.UseMarkedBills = false -- true for marked bills, false for cash QBConfig.UseMarkedBills = false -- true for marked bills, false for cash
QBConfig.DeliveryRepGain = 1 -- amount of rep gained per delivery QBConfig.DeliveryRepGain = 1 -- amount of rep gained per delivery