Skip to content

No open Player target inventory #1858

Description

@Goz-exe

Hi everyone, I'm having a very neurotic problem, running this code in my fivem ESX client-side I keep getting the message "you can't open this inventory" but I can't understand what's wrong having followed the documentation

function isPlayerDead(entity)
    return Entity(entity).state and Entity(entity).state.isDead
end

exports.ox_target:addGlobalPlayer({
    name = 'search_dead_player',
    label = 'Search dead Player',
    icon = 'fas fa-magnifying-glass',
    distance = 3,
    canInteract = function(entity, distance)
        return isPlayerDead(entity)  
    end,
    onSelect = function(data)
        local targetPlayer = GetPlayerServerId(NetworkGetPlayerIndexFromPed(data.entity))
        if not targetPlayer then return end
        
        exports.ox_inventory:openInventory("player", targetPlayer)
    end
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions