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

Paylaşım Tamamıyla Disc Uyumlu esx-drugs

hasannnnn

Üye
FT Kullanıcı
Katılım
4 yıl 23 gün
Mesajlar
931
esx-drugs scriptini disce uyarlamakta zorluk çekenler için ayarlayıp paylaşıyorum.
server kısmında aşşağıdaki 0.1 'i kendi datanızdaki ağırlığına göre ayarlarsanız sıkıntısız çalışır.
Kod:
if xMarijuana.weight ~= 0.1 and (xMarijuana.count + 1) >= xMarijuana.weight then

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

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)


AddEventHandler('hasan:itemsil3', function(source)
    local xPlayer = ESX.GetPlayerFromID(_source)
    xPlayer.removeInventoryItem('cannabis', 1)
end)

Benim disc-inventoryhudumda ne alakadır bilmiyorum çalışmadı, Hasan hocamdan yardım istedim server/main.luanın içini eklediğim kodla değiştirdi istiyen ulaşabilir Hasan hocam tekrar sağol :).
 
Merhaba dediğiniz şekilde ekledim ancak Keneviri işlediğim zaman üzerime işlenmiş kenevir gelmiyor.
 
Merhaba , Dediklerinizi yaptım keneviri topluyabiliyorum işlemeye gidince sadece 1 kere işliyorum sonra bidaha e basın çıkmıyor sebebi nedir ?
 

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!