Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No open Player target inventory #1858

Open
Goz-exe opened this issue Dec 27, 2024 · 1 comment
Open

No open Player target inventory #1858

Goz-exe opened this issue Dec 27, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Goz-exe
Copy link

Goz-exe commented Dec 27, 2024

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
})
@Goz-exe Goz-exe added the enhancement New feature or request label Dec 27, 2024
@Goz-exe Goz-exe changed the title No open Player inventory No open Player target inventory Dec 27, 2024
@Goz-exe
Copy link
Author

Goz-exe commented Dec 27, 2024

Ok as I said I had to intervene on the animations performed, I highly recommend including it in the documentation

local function canOpenTarget(ped)
return IsPedFatallyInjured(ped)
or IsEntityPlayingAnim(ped, 'dead', 'dead_a', 3)
or IsPedCuffed(ped)
or IsEntityPlayingAnim(ped, 'mp_arresting', 'idle', 3)
or IsEntityPlayingAnim(ped, 'missminuteman_1ig_2', 'handsup_base', 3)
or IsEntityPlayingAnim(ped, 'missminuteman_1ig_2', 'handsup_enter', 3)
or IsEntityPlayingAnim(ped, 'random@mugging3', 'handsup_standing_base', 3)
or IsEntityPlayingAnim(ped, 'combat@damage@writhe', 'writhe_loop', 3) <-- ADDED THIS
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant