esx_inventoryhud - gedroppte Items gehen an alle Spieler?

  • Heyho!


    Mir ist gerade aufgefallen, das es bei esx_inventoryhud (meines Wissens) es ein kleinen Bug gibt...

    Es ist nicht gerade cool, das wenn ich einen Gegenstand fallen lassen, dies jeder Spieler vor sich gedroppt bekommt.

    Hat jemand zufällig einen Fix dafür?


    Danke im Vorraus ;)

  • Nun es gibt sicher dafür eine elegantere Lösung, ich habe aber einfach das droppen so umgeschrieben, dass wenn Items auf Gegenstände fallenlassen gezogen werden, das Spiel diese löscht, also das keine mehr droppen. Gibt bestimmt eine elegantere Lösung, aber eine andere hab ich auf die schnell für das Problem nicht gefunden.

  • To write in your [esx_inventoryhud\client\main.lua]



    RegisterNUICallback( "DropItem", function(data, cb) if IsPedSittingInAnyVehicle(playerPed) then return end
    if type(data.number) == "number" and math.floor(data.number) == data.number then TriggerServerEvent("esx_inventoryhud:deleteItem", data.item.type, data.item.name, data.number) end
    Wait(250) loadPlayerInventory()
    cb("ok") end
    )







    and to write in your [esx_inventoryhud\server\main.lua]


    RegisterNetEvent("esx_inventoryhud:deleteItem")
    AddEventHandler(
    "esx_inventoryhud:deleteItem", function(itemType, itemName, nb)
    local playerId = source
    local xPlayer = ESX.GetPlayerFromId(source)
    itemCount = nb

    if itemType == 'item_standard' then
    if itemCount == nil or itemCount < 1 then
    xPlayer.showNotification(
    'invalid quantity')
    else
    local xItem = xPlayer.getInventoryItem(itemName)

    if (itemCount > xItem.count or xItem.count < 1) then
    xPlayer.showNotification(
    'invalid quantity')
    else
    xPlayer.removeInventoryItem(itemName, itemCount)
    end
    end
    elseif itemType == 'item_account' then
    if itemCount == nil or itemCount < 1 then
    xPlayer.showNotification(
    'invalid amount')
    else
    local account = xPlayer.getAccount(itemName)

    if (itemCount > account.money or account.money < 1) then
    --xPlayer.showNotification(_U('imp_invalid_amount'))
    xPlayer.showNotification(
    'invalid amount')
    else
    xPlayer.removeAccountMoney(itemName, itemCount)
    end
    end
    elseif itemType == 'item_weapon' then
    itemName =
    string.upper(itemName)

    if xPlayer.hasWeapon(itemName) then
    local _, weapon = xPlayer.getWeapon(itemName)
    local _, weaponObject = ESX.GetWeapon(itemName)
    local components, pickupLabel = ESX.Table.Clone(weapon.components)
    xPlayer.removeWeapon(itemName)
    xPlayer.showNotification(
    'Threw weapon : '..weapon.label)

    if weaponObject.ammo and weapon.ammo > 0 then
    local ammoLabel = weaponObject.ammo.label
    else
    xPlayer.showNotification(
    'threw weapon :'..weapon.label)
    end

    end
    end

    end)

    Am besten Backup von beiden Ressourcen machen wenn du dies änderst

    ;) Bei mir hat dass geholfen!