Comments (3)
@galibmahin replace this function
local function InitiateSell(ped, randamt)
local AlreadySold = false
local k = CurrentZone.name
randamt = randamt or 1 -- Set the default value for randamt if it's not provided
if Config.ZoneDrugs[k] then
local player = QBCore.Functions.GetPlayerData()
local playerInventory = player.items
for _, randdrug in ipairs(Config.ZoneDrugs[k]) do
local price = randdrug.price
local item = QBCore.Shared.Items[randdrug.item]
local itemData = nil
for _, inventoryItem in ipairs(playerInventory) do
if inventoryItem.name == randdrug.item then
itemData = inventoryItem
break
end
end
if not AlreadySold then
if itemData and itemData.amount >= randamt then
AlreadySold = true
InitiateSellProgress = true
local SaleMenu = {
{
header = tostring(randamt).."x of "..QBCore.Shared.Items[tostring(randdrug.item)]['label'].." for "..QBCore.Shared.Round(randamt * price, 0).."$",
isMenuHeader = true
},
{
header = "Accept Offer",
params = {
event = 'cad-drugsales:salesinitiate',
args = {
type = 'buy',
item = randdrug.item,
price = price,
amt = randamt,
tped = ped
}
}
},
{
header = "Decline Offer",
params = {
event = 'cad-drugsales:salesinitiate',
args = {
type = 'close',
tped = ped
}
}
}
}
exports[Config.Menu]:openMenu(SaleMenu)
TimeoutMenu(ped)
break
else
if Config.Debug then
print("You don't have enough ["..randdrug.item.."] to sell")
if itemData then
print("You have ["..itemData.amount.."] but need ["..randamt.."]")
else
print("You have [0] but need ["..randamt.."]")
end
end
end
end
end
if not AlreadySold then
SetPedAsNoLongerNeeded(ped)
TriggerEvent('QBCore:Notify', 'Person wanted more stuff but you didn\'t have!')
end
end
end
from cad-drugsales.
are you using old qbcore?
from cad-drugsales.
@MadManDanCat & @galibmahin
Pushed Version 2.1.2 which should be a permanent fix to these
from cad-drugsales.
Related Issues (15)
- question HOT 1
- "Talk" and nothing happen. HOT 3
- Dublicated sell drugs options HOT 2
- Script Error on sale HOT 7
- Ped targetting - qb-target HOT 1
- initiateSell Issue HOT 2
- For put more drugs not sell HOT 3
- adding new locations HOT 1
- issue HOT 3
- You cannot target other peds outside of the zones you create. HOT 3
- Bug with newest fix
- qb-shop compatibility problem HOT 1
- poly points HOT 2
- C
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cad-drugsales.