How To Add Ped In Ox_inventory

I make a redesign of ox_inventory and i want to add peds in the inventory like this
image

The problem is when i push code like this :

function createPedScreen()

CreateThread(function()

    heading = GetEntityHeading(PlayerPedId())
    SetScriptGfxAlign(67, 67)
    
    SetFrontendActive(true)

    ActivateFrontendMenu('FE_MENU_VERSION_EMPTY', true, -1)

    Citizen.Wait(100)

    N_0x98215325a695e78a(false)

    PlayerPedPreview = ClonePed(PlayerPedId(), heading, true, false)

    local x,y,z = table.unpack(GetEntityCoords(PlayerPedPreview))

    SetEntityCoords(PlayerPedPreview, x ,y,z-100)

    FreezeEntityPosition(PlayerPedPreview, true)

    SetEntityVisible(PlayerPedPreview, false, false)

    NetworkSetEntityInvisibleToNetwork(PlayerPedPreview, false)

    Wait(200)

    SetPedAsNoLongerNeeded(PlayerPedPreview)



    GivePedToPauseMenu(PlayerPedPreview, 2)
    

    SetPauseMenuPedLighting(true)

    SetPauseMenuPedSleepState(false)

end)

end

I have this :


without my inventory, how i can do this with my ox inventory please ?

Your inventory has to be (openable?) in a pause menu somehow. It has to be a pause menu itself I believe like other inventories. Then it’ll show ur inv around it.

yes its the ox inventory

he open the inv and after open this

do you have ox_inventory with peds or not please ?

did you find the solution?

I think I have an idea I think you didn’t put your code in the right place so your script executes it puts the ped but not the inventory

Yea but its a paid solution lol

1 Like

Hi, Did you solve the problem please?

Sadly No, but i made it work kinda, if your interested PM Me,
this is the code i used inn ox_inventory/client.lua

pedexists = false
function CreatePed()
	CreateThread(function()

        heading = GetEntityHeading(PlayerPedId())
        SetScriptGfxAlign(67, 67)
        
        SetFrontendActive(true)
    
       ActivateFrontendMenu('FE_MENU_VERSION_EMPTY', true, -1)
    
        Citizen.Wait(100)
    
        N_0x98215325a695e78a(false)
    
        PlayerPedPreview = ClonePed(PlayerPedId(), heading, true, false)
    
        local x,y,z = table.unpack(GetEntityCoords(PlayerPedPreview))
    
        SetEntityCoords(PlayerPedPreview, x ,y,z-100)
    
        FreezeEntityPosition(PlayerPedPreview, true)
    
        SetEntityVisible(PlayerPedPreview, false, false)
    
        NetworkSetEntityInvisibleToNetwork(PlayerPedPreview, false)
		
		makeEntityFaceFront(PlayerPedPreview)
		
       
        SetPedAsNoLongerNeeded(PlayerPedPreview)
        GivePedToPauseMenu(PlayerPedPreview, 2)
        SetPauseMenuPedLighting(true)
    
        SetPauseMenuPedSleepState(true)
        SetScriptGfxDrawBehindPausemenu(true)
        DrawRect(0.5, 0.5, 1, 1, 60, 60, 60, 200)
        SetScriptGfxDrawBehindPausemenu(false)

        if showing == false then
            ReplaceHudColourWithRgba(117, 0, 0, 0, 0)
        else
            ReplaceHudColourWithRgba(117, 0, 0, 0, 186)
        end
        showing = not showing
    end)
	pedexists = not pedexists
end

function makeEntityFaceFront(Entity)
	local heading = GetEntityHeading(Entity)
	SetEntityHeading(Entity, heading)
end

function DeletePed()
	if pedexists == true then
	CreatePed()
end
end

and you need to remove

    -- if IsPauseMenuActive() then return end

because the ped is a pause menu asset, and counts as pausemenu,

(and also add the functions to where it belongs) maybe ill create a redesign soon. lol

it shows the ped behind the inventory, any redesign would work, :slight_smile:

You sure about that part ? :joy:

,
Yes because if you read the native, (which u clearly didnt) u would know its a toggle and that my code is example code. please stop being so negative abt bad Code we all are humans. it was made in less then 5 mins. without Prior Knowledge, but yeah thanks for giving a funny comment without Reading into it, rly helped.

Wasn’t being negative, just running on lack of sleep sorry if it transpired incorrectly.
I noticed the toggle but wasn’t convinced on the flow of it, it’s an interesting one that I wouldn’t of done.

I did something similar, but couldn’t get the mouse to hide.

However after looking with some extra sleep on what you’ve done I noticed that you used ClonePed but passing the arguments for ClonePedEx, passing heading instead of a boolean would make it behave as a truthful value if I’m not mistaken ?
I’ve noticed that there didn’t seem to be any need for setting the PlayerPedPreview’s location or heading, the native to add him to the pausemenu seems to handle it by default.

What I was wondering was how to enlarge the ped to seem bigger.