Neler yeni

Foruma hoş geldin, Ziyaretçi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı ya da giriş yapmalısınız. Foruma üye olmak tamamen ücretsizdir.

Türkiye'nin İlk ve tek FiveM forum adresi

Forum adresimize hoş geldin FiveMTürk olarak amacımız siz değerli kullanıcılarımıza en aktif fikir ve paylaşım platformu sunmak bir yana en güvenilir şekilde alışveriş yapabileceğiniz bir platform sunmaktır.
DF DF
DF DF
DF DF

Cevaplandı [İSTEK] Disc-inventoryhud item verme durumu nasıl ekleyebilirim?

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

33selim33

Üye
FT Kullanıcı
Katılım
4 yıl 5 ay 13 gün
Mesajlar
37
Web sitesi
meettomy.site
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

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)
 
DF
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

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)


Kod:
RegisterServerEvent('esx_drugs:pickedUpCannabis')
AddEventHandler('esx_drugs:pickedUpCannabis', function()
    local xPlayer = ESX.GetPlayerFromId(source)
    local xItem = xPlayer.getInventoryItem('cannabis')

    if 40 ~= -1 and (xItem.count + 1) > 40 then
        TriggerClientEvent('esx:showNotification', _source, _U('weed_inventoryfull'))
   -- TriggerEvent('disc-inventoryhud:yenile')
    else
        if xPlayer.canCarryItem(xItem.name, 1) then
            xPlayer.addInventoryItem(xItem.name, 1)
        else
            TriggerClientEvent('mythic_notify:client:SendAlert', xPlayer.source, {type = 'error', text = 'Daha fazla taşıyamazsın!' })           
        end
    end
end)

ESX.RegisterServerCallback('esx_drugs:canPickUp', function(source, cb, item)
    local xPlayer = ESX.GetPlayerFromId(source)
    local xItem = xPlayer.getInventoryItem(item)

    if 40 ~= -1 and xItem.count >= 40 then
        cb(false)
    else
        cb(true)
    end
end)

RegisterServerEvent('esx_drugs:processCannabis')
AddEventHandler('esx_drugs:processCannabis', 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('cannabis'), xPlayer.getInventoryItem('marijuana')

            if xMarijuana.weight ~= 0.5 and (xMarijuana.count + 1) >= xMarijuana.weight then
                TriggerClientEvent('esx:showNotification', _source, _U('weed_processingfull'))
            elseif xCannabis.count < 2 then
                TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough'))
            else
                if xPlayer.canCarryItem('marijuana', 1) then
                    xPlayer.removeInventoryItem('cannabis', 2)
                    xPlayer.addInventoryItem('marijuana', 1)
                    TriggerClientEvent('esx:showNotification', _source, _U('weed_processed'))
                else
                    TriggerClientEvent('mythic_notify:client:SendAlert', xPlayer.source, {type = 'error', text = 'Daha fazla taşıyamazsın!' })
                end
            end

            playersProcessingCannabis[_source] = nil
        end)
    else
        print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1]))
    end
end)

bu şekilde değiştirip dener misiniz ?
 
DF
Kod:
RegisterServerEvent('esx_drugs:pickedUpCannabis')
AddEventHandler('esx_drugs:pickedUpCannabis', function()
    local xPlayer = ESX.GetPlayerFromId(source)
    local xItem = xPlayer.getInventoryItem('cannabis')

    if 40 ~= -1 and (xItem.count + 1) > 40 then
        TriggerClientEvent('esx:showNotification', _source, _U('weed_inventoryfull'))
   -- TriggerEvent('disc-inventoryhud:yenile')
    else
        if xPlayer.canCarryItem(xItem.name, 1) then
            xPlayer.addInventoryItem(xItem.name, 1)
        else
            TriggerClientEvent('mythic_notify:client:SendAlert', xPlayer.source, {type = 'error', text = 'Daha fazla taşıyamazsın!' })          
        end
    end
end)

ESX.RegisterServerCallback('esx_drugs:canPickUp', function(source, cb, item)
    local xPlayer = ESX.GetPlayerFromId(source)
    local xItem = xPlayer.getInventoryItem(item)

    if 40 ~= -1 and xItem.count >= 40 then
        cb(false)
    else
        cb(true)
    end
end)

RegisterServerEvent('esx_drugs:processCannabis')
AddEventHandler('esx_drugs:processCannabis', 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('cannabis'), xPlayer.getInventoryItem('marijuana')

            if xMarijuana.weight ~= 0.5 and (xMarijuana.count + 1) >= xMarijuana.weight then
                TriggerClientEvent('esx:showNotification', _source, _U('weed_processingfull'))
            elseif xCannabis.count < 2 then
                TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough'))
            else
                if xPlayer.canCarryItem('marijuana', 1) then
                    xPlayer.removeInventoryItem('cannabis', 2)
                    xPlayer.addInventoryItem('marijuana', 1)
                    TriggerClientEvent('esx:showNotification', _source, _U('weed_processed'))
                else
                    TriggerClientEvent('mythic_notify:client:SendAlert', xPlayer.source, {type = 'error', text = 'Daha fazla taşıyamazsın!' })
                end
            end

            playersProcessingCannabis[_source] = nil
        end)
    else
        print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1]))
    end
end)

bu şekilde değiştirip dener misiniz ?
maalesef hocam işe yaramadı
 
DF
Disc kullandığınız için server sideda bulunan limitleri weighte çevirip uyarlamanız lazım.Olmazsa discorddan ekleyin yardımcı olmaya çalışayım
 
DF
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Forumdan daha fazla yararlanmak için giriş yapın yada üye olun!

Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!

Kayıt ol

Forumda bir hesap oluşturmak tamamen ücretsizdir.

Şimdi kayıt ol
Giriş yap

Eğer bir hesabınız var ise lütfen giriş yapın

Giriş yap

Bu konuyu görüntüleyen kullanıcılar

Tema düzenleyici

Tema özelletirmeleri

Granit arka planlar

Lütfen Javascript'i etkinleştirin!Javascript'i etkinleştirin!