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

Soru İki inventory weight

  • Konbuyu başlatan karpuz
  • Başlangıç tarihi
  • Cevaplar 3
  • Görüntüleme 619

karpuz

Üye
FT Kullanıcı
Katılım
4 yıl 1 ay 7 gün
Mesajlar
158
Selamlar bende iki tane envanter var şimdi bu envanter es_extendedın kendi weightini kullanmıyor. Ben nasıl es_extendedın ağırlığını eklediğim ikinci envanterin ağırlığına eşitlerim denediğim şeylerden biri
Kod:
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.weight = weight
bu kodu eklediğim envanterin weight hesaplamasının sonuna ekliyorum
Kod:
function loadPlayerInventory()
    ESX.TriggerServerCallback("esx_inventoryhud:getPlayerInventory", function(data)
        items = {}
        fastItems = {}
        inventory = data.inventory
        accounts = data.accounts
        money = data.money
        weapons = data.weapons
       
        if Config.IncludeCash and money ~= nil and money > 0 then
            for key, value in pairs(accounts) do
                moneyData = {
                    label = _U("cash"),
                    name = "cash",
                    type = "item_money",
                    count = money,
                    usable = false,
                    rare = false,
                    limit = -1,
                    canRemove = true
                }
               
                table.insert(items, moneyData)
            end
        end
       
        if Config.IncludeAccounts and accounts ~= nil then
            for key, value in pairs(accounts) do
                if not shouldSkipAccount(accounts[key].name) then
                    local canDrop = accounts[key].name ~= "bank"
                   
                    if accounts[key].money > 0 then
                        accountData = {
                            label = accounts[key].label,
                            count = accounts[key].money,
                            type = "item_account",
                            name = accounts[key].name,
                            usable = false,
                            rare = false,
                            limit = -1,
                            canRemove = canDrop
                        }
                        table.insert(items, accountData)
                    end
                end
            end
        end
       
        if inventory ~= nil then
            for key, value in pairs(inventory) do
                if inventory[key].count <= 0 then
                    inventory[key] = nil
                else
                    inventory[key].type = "item_standard"
                    table.insert(items, inventory[key])
                --widgetTotal = getInventoryWeight(items)
                end
            end
        end
       
        if Config.IncludeWeapons and weapons ~= nil then
            for key, value in pairs(weapons) do
                local weaponHash = GetHashKey(weapons[key].name)
                local playerPed = PlayerPedId()
                if HasPedGotWeapon(playerPed, weaponHash, false) and weapons[key].name ~= "WEAPON_UNARMED" then
                    local found = false
                    for slot, weapon in pairs(fastWeapons) do
                        if weapon == weapons[key].name then
                            local ammo = GetAmmoInPedWeapon(playerPed, weaponHash)
                            table.insert(
                                fastItems,
                                {
                                    label = weapons[key].label,
                                    count = ammo,
                                    limit = -1,
                                    type = "item_weapon",
                                    name = weapons[key].name,
                                    usable = false,
                                    rare = false,
                                    canRemove = true,
                                    slot = slot
                                }
                            )
                            found = true
                            break
                        end
                    end
                    if found == false then
                        local ammo = GetAmmoInPedWeapon(playerPed, weaponHash)
                        table.insert(
                            items,
                            {
                                label = weapons[key].label,
                                count = ammo,
                                limit = -1,
                                type = "item_weapon",
                                name = weapons[key].name,
                                usable = false,
                                rare = false,
                                canRemove = true
                            }
                    )
                    end
                end
            end
        end
       
        local arrayWeight = Config.localWeight
        local arraySilah = Config.localSilah
        local weight = 0
        local itemWeight = 0
        local silahWeight = 0
        local itemsW = 0
        if items ~= nil then
            for i = 1, #items, 1 do
                if items[i] ~= nil then
                    itemWeight = Config.DefaultWeight
                    itemWeight = itemWeight / items[1].count * 0.0
                    if arraySilah[items[i].name] ~= nil then
                        silahWeight = arraySilah[items[i].name]
                        weight = weight + silahWeight
                    end
                    if arrayWeight[items[i].name] ~= nil then
                        itemWeight = arrayWeight[items[i].name]
                        items[i].limit = itemWeight / 1000
                    end
                    weight = weight + (itemWeight * (items[i].count or 1))
                end
            end
        end
       
        local arrayWeight = Config.localWeight
        local arraySilah = Config.localSilah
        local itemWeight = 0
        local silahWeight = 0
        if fastItems ~= nil then
            for i = 1, #fastItems, 1 do
                if fastItems[i] ~= nil then
                    itemWeight = Config.DefaultWeight
                    itemWeight = itemWeight / items[1].count * 0.0
                    if arraySilah[fastItems[i].name] ~= nil then
                        silahWeight = arraySilah[fastItems[i].name]
                        weight = weight + silahWeight
                    end
                    if arrayWeight[fastItems[i].name] ~= nil then
                        itemWeight = arrayWeight[fastItems[i].name]
                        fastItems[i].limit = itemWeight / 1000
                    end
                    weight = weight + (itemWeight * (fastItems[i].count or 1))

                end
            end
        end
        local texts = _U("player_info", GetPlayerName(PlayerId()), (weight / 1000), (Config.Limit / 1000))
       
        if weight > Config.Limit then
            exports['mythic_notify']:SendAlert('error', 'Inventário Cheio! Não Consegues Andar')
            --[[TriggerEvent("pNotify:SendNotification",  {
            text =  'Inventário Cheio! Não Consegues Andar',
            type = "error",
            timeout = 2000,
            layout = "centerLeft"
            })--]]
            --Uncomment this to Use pNotify
            setHurt()
           
            texts = _U("player_info_full", GetPlayerName(PlayerId()), (weight / 1000), (Config.Limit / 1000))
        elseif weight <= Config.Limit then
            setNotHurt()
            texts = _U("player_info", GetPlayerName(PlayerId()), (weight / 1000), (Config.Limit / 1000))
        end
       
        SendNUIMessage(
            {
                action = "setItems",
                itemList = items,
                fastItems = fastItems,
                text = texts
            })
    end, GetPlayerServerId(PlayerId())
)

end
local texts = _U("player_info", GetPlayerName(PlayerId()), (weight / 1000), (Config.Limit / 1000)) bunun altına ama o zaman eklediğim envanterin ağırlığı 0 oluyor.
8513
 
Son düzenleme:
es_extended/client/main.lua

ctrl + f

Kod:
Citizen.CreateThread(function()
    while true do

        Citizen.Wait(0)

        if IsControlJustReleased(0, Keys['F2']) and IsInputDisabled(0) and not isDead and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
            ESX.ShowInventory()
        end

    end
end)

Bulduğun satırı bununla değiştir;


Kod:
--[[Citizen.CreateThread(function()
    while true do

        Citizen.Wait(0)

        if IsControlJustReleased(0, Keys['F2']) and IsInputDisabled(0) and not isDead and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
            ESX.ShowInventory()
        end

    end
end)]]

edit: Konuyu tam olarak okumamışım özür diliyorum.
 
yok mu es_extended içinde işlenen verinin değerini başka bir scriptle değiştirmeyi bilen ?
 
karpuz discord unu atabilirmisin
 

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!