- fix bug with comparing rep

- fix travellingmerchant
This commit is contained in:
Mustache Dom committed 2025-08-11 16:49:24 -06:00
1 parent ca50437751
commit a079efd5c8
6 files changed
+26 -20

No files matched your search

+5 -4
View File
@@ -1,19 +1,20 @@
local function spawn() local function spawn()
local location, menus = ps.callback('md-drugs:server:GetMerchant') local data = ps.callback('md-drugs:server:GetMerchant')
local model = 's_m_m_trucker_01' local model = 's_m_m_trucker_01'
ps.requestModel(model) ps.requestModel(model)
local ped = CreatePed(4, model, location.x, location.y, location.z, location.w, false, true) local ped = CreatePed(4, model, data.loc.x, data.loc.y, data.loc.z, data.loc.w, false, true)
Freeze(ped, true, location.w) Freeze(ped, true, data.loc.w)
ps.entityTarget(ped, { ps.entityTarget(ped, {
{ {
label = ps.lang('merchant.targetOpen'), label = ps.lang('merchant.targetOpen'),
action = function() action = function()
local options = {} local options = {}
for k, v in pairs (menus) do for k, v in pairs (data.items) do
options[#options+1] = { options[#options+1] = {
title = ps.getLabel(k), title = ps.getLabel(k),
description = '$'..v, description = '$'..v,
icon = ps.getImage(k),
action = function() action = function()
ps.triggerServerEvent('md-drugs:server:purchaseGoods', k) ps.triggerServerEvent('md-drugs:server:purchaseGoods', k)
end end
+2 -2
View File
@@ -97,7 +97,7 @@ for k, v in pairs(locations.isosafrole) do
end end
for k, v in pairs(locations.rawxtcloc) do for k, v in pairs(locations.rawxtcloc) do
ps.boxTarget('xtc'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('xtcraw'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-flask', icon = 'fa-solid fa-flask',
label = ps.lang('xtc.targetRaw'), label = ps.lang('xtc.targetRaw'),
@@ -157,7 +157,7 @@ for k, v in pairs(locations.xtcpress) do
end end
for k, v in pairs (locations.stamp) do for k, v in pairs (locations.stamp) do
ps.boxTarget('xtc'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, { ps.boxTarget('xtcstamp'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
{ {
icon = 'fa-solid fa-flask', icon = 'fa-solid fa-flask',
label = ps.lang('xtc.targetStamp'), label = ps.lang('xtc.targetStamp'),
+7 -1
View File
@@ -243,6 +243,12 @@ Lang.xtc = {
noPills = 'You Dont Have Any Unstamped Pills' noPills = 'You Dont Have Any Unstamped Pills'
} }
Lang.merchant = {
targetOpen = 'Open Merchant Menu',
targetClose = 'Close Merchant Menu',
notEnoughMoney = 'You Do Not Have Enough Money',
purchased = 'You Purchased %s For $%s',
canceled = 'You Canceled The Purchase'
}
return Lang return Lang
+1 -1
View File
@@ -39,7 +39,7 @@ local stores = {
} }
ps.registerCallback('md-drugs:server:GetMerchant', function(source) ps.registerCallback('md-drugs:server:GetMerchant', function(source)
return loc, stores.travel return {loc = loc, items = stores.travel}
end) end)
+1 -1
View File
@@ -45,7 +45,7 @@ RegisterServerEvent('md-drugs:server:makepowder', function(num)
end end
local tier = 'tier1' local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local coke = getRep(src, 'coke') local coke = tonumber(getRep(src, 'coke'))
if coke > Config.Tier1 and coke <= Config.Tier2 then if coke > Config.Tier1 and coke <= Config.Tier2 then
tier = 'tier2' tier = 'tier2'
elseif coke > Config.Tier2 then elseif coke > Config.Tier2 then
+10 -11
View File
@@ -55,8 +55,6 @@ ps.registerCallback('removeCleaningkit', function(source)
return false return false
end) end)
RegisterServerEvent('md-drugs:server:dryplant', function(num) RegisterServerEvent('md-drugs:server:dryplant', function(num)
local src = source local src = source
if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then if not ps.checkDistance(src, heroinLocations.dryplant[num].loc, 3.0) then
@@ -66,7 +64,7 @@ RegisterServerEvent('md-drugs:server:dryplant', function(num)
local tier = 'tier1' local tier = 'tier1'
if Config.TierSystem then if Config.TierSystem then
local heroin = getRep(src, 'heroin') local heroin = tonumber(getRep(src, 'heroin'))
if heroin <= Config.Tier1 then if heroin <= Config.Tier1 then
tier = 'tier1' tier = 'tier1'
elseif heroin >= Config.Tier1 and heroin <= Config.Tier2 then elseif heroin >= Config.Tier1 and heroin <= Config.Tier2 then
@@ -153,14 +151,15 @@ ps.createUseable('heroinlabkit', function(source, item)
if not ps.hasItem(src, 'heroinlabkit', 1) then return end if not ps.hasItem(src, 'heroinlabkit', 1) then return end
local placed, loc = ps.callback('md-drugs:client:setheroinlabkit', src) local placed, loc = ps.callback('md-drugs:client:setheroinlabkit', src)
if placed then if placed then
ps.removeItem(src, 'heroinlabkit', 1) if ps.removeItem(src, 'heroinlabkit', 1) then
table.insert(heroinLabKits, { table.insert(heroinLabKits, {
src = src, src = src,
ownerid = ps.getIdentifier(src), ownerid = ps.getIdentifier(src),
coords = loc, coords = loc,
name = ps.getPlayerName(src) name = ps.getPlayerName(src)
}) })
ps.notify(src, ps.lang('heroin.placedKit'), "success") ps.notify(src, ps.lang('heroin.placedKit'), "success")
end
end end
end) end)