Merhaba arkadaşlar disc-inventoryhud kullanıyorum sunucumda esx_drugs ile uyumlu hale getirmeye çalışıyorum tarladan keneviri toplayınca envantere item olarak eklemesini istiyorum kenevirin üzerine gidip e basınca hiç bir şey olmuyor eğilip topluyordu falan hiç bişey gerçekleşmiyor disc-inventoryhud'a geçince bu sorun oldu
Aşağıya kullandığım esx_drugs scriptini ekliyorum aslında "glybera" diye bir illegal sistemiyle değiştirmişler ama mantık aynı esx_drugs düzenlenerek yapılmış sanırım
TriggerEvent('disc-inventoryhud:addItem', source, name, count)
böyle bişey vermişler ama ordaki source name count kısmını falan nasıl düzenlemem gerektiğini bilmiyorum neyi nereye nasıl eklemem lazım anlayam birisi varsa yardımınızı bekliyorum.Aşağıya kullandığım esx_drugs scriptini ekliyorum aslında "glybera" diye bir illegal sistemiyle değiştirmişler ama mantık aynı esx_drugs düzenlenerek yapılmış sanırım
Kod:
ESX = nil
local playersProcessingCannabis = {}
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('esx_drugs:sellDrug')
AddEventHandler('esx_drugs:sellDrug', function(itemName, amount)
local xPlayer = ESX.GetPlayerFromId(source)
local price = Config.DrugDealerItems[itemName]
local xItem = xPlayer.getInventoryItem(itemName)
if not price then
print(('esx_drugs: %s attempted to sell an invalid drug!'):format(xPlayer.identifier))
return
end
if xItem.count < amount then
TriggerClientEvent('esx:showNotification', source, _U('dealer_notenough'))
return
end
price = ESX.Math.Round(price * amount)
if Config.GiveBlack then
xPlayer.addAccountMoney('black_money', price)
else
xPlayer.addMoney(price)
end
xPlayer.removeInventoryItem(xItem.name, amount)
TriggerClientEvent('esx:showNotification', source, _U('dealer_sold', amount, xItem.label, ESX.Math.GroupDigits(price)))
end)
ESX.RegisterServerCallback('esx_drugs:buyLicense', function(source, cb, licenseName)
local xPlayer = ESX.GetPlayerFromId(source)
local license = Config.LicensePrices[licenseName]
if license == nil then
print(('esx_drugs: %s attempted to buy an invalid license!'):format(xPlayer.identifier))
cb(false)
end
if xPlayer.getMoney() >= license.price then
xPlayer.removeMoney(license.price)
TriggerEvent('esx_license:addLicense', source, licenseName, function()
cb(true)
end)
else
cb(false)
end
end)
RegisterServerEvent('esx_drugs:pickedUpGlybera')
AddEventHandler('esx_drugs:pickedUpGlybera', function()
local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem('opium')
if xItem.limit ~= -1 and (xItem.count + 1) > xItem.limit then
TriggerClientEvent('esx:showNotification', _source, _U('weed_inventoryfull'))
else
xPlayer.addInventoryItem(xItem.name, 1)
end
end)
ESX.RegisterServerCallback('esx_drugs:canPickUp', function(source, cb, item)
local xPlayer = ESX.GetPlayerFromId(source)
local xItem = xPlayer.getInventoryItem(item)
if xItem.limit ~= -1 and xItem.count >= xItem.limit then
cb(false)
else
cb(true)
end
end)
RegisterServerEvent('esx_drugs:processGlybera')
AddEventHandler('esx_drugs:processGlybera', function()
if not playersProcessingCannabis[source] then
local _source = source
playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing, function()
local xPlayer = ESX.GetPlayerFromId(_source)
local xCannabis, xMarijuana = xPlayer.getInventoryItem('opium'), xPlayer.getInventoryItem('opium')
if xMarijuana.limit ~= -1 and (xMarijuana.count + 1) >= xMarijuana.limit then
TriggerClientEvent('esx:showNotification', _source, _U('weed_processingfull'))
elseif xCannabis.count < 10 then
TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough'))
else
xPlayer.removeInventoryItem('opium', 10)
xPlayer.addInventoryItem('opium_pooch', 1)
TriggerClientEvent('esx:showNotification', _source, _U('weed_processed'))
end
playersProcessingCannabis[_source] = nil
end)
else
print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1]))
end
end)
function CancelProcessing(playerID)
if playersProcessingCannabis[playerID] then
ESX.ClearTimeout(playersProcessingCannabis[playerID])
playersProcessingCannabis[playerID] = nil
end
end
RegisterServerEvent('esx_drugs:cancelProcessing')
AddEventHandler('esx_drugs:cancelProcessing', function()
CancelProcessing(source)
end)
AddEventHandler('esx:playerDropped', function(playerID, reason)
CancelProcessing(playerID)
end)
RegisterServerEvent('esx:onPlayerDeath')
AddEventHandler('esx:onPlayerDeath', function(data)
CancelProcessing(source)
end)
