This is a continuation of this topic:
I’m working on a Vrp fivem server, and trying to make an inventory system.
My goal is to show the player inventory along with his current ped model.
Something like this
I was able to show the ped and inventory at the same time
Code:
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
As you can see, they don’t align properly.
So my next goal is to change the default position of the ped in the screen.
4 Likes
For who want more change
positioned on the left:
GivePedToPauseMenu(PlayerPedPreview, 0)
positioned in the center:
GivePedToPauseMenu(PlayerPedPreview, 1)
positioned on the right:
GivePedToPauseMenu(PlayerPedPreview, 2)
change background color:
ReplaceHudColourWithRgba(117, 0, 0, 0, 0) --transparent
3 Likes
Can be done, i’m porting this idea to the scripts.
This is example, but i’ll try another way too
New way is render camera.it’s better than clone ped, because you can se ped in real action for using items, attach weapons…
1 Like
Yes its true,
I think, i’m gonna make this too.
2 Likes
Any one knows why my ped is disappearing?
My code:
function createPedScreen()
CreateThread(function()
heading = GetEntityHeading(PlayerPedId())
SetFrontendActive(true)
ActivateFrontendMenu(GetHashKey("FE_MENU_VERSION_EMPTY_NO_BACKGROUND"), true, -1)
Wait(100)
N_0x98215325a695e78a(false)
PlayerPedPreview = ClonePed(PlayerPedId(), heading, true, false)
local x,y,z = table.unpack(GetEntityCoords(PlayerPedPreview))
SetEntityCoords(PlayerPedPreview, x,y,z-10)
FreezeEntityPosition(PlayerPedPreview, true)
SetEntityVisible(PlayerPedPreview, false, false)
NetworkSetEntityInvisibleToNetwork(PlayerPedPreview, false)
Wait(200)
SetPedAsNoLongerNeeded(PlayerPedPreview)
GivePedToPauseMenu(PlayerPedPreview, 2)
SetPauseMenuPedLighting(true)
SetPauseMenuPedSleepState(true)
ReplaceHudColourWithRgba(117, 0, 0, 0, 0)
previewPed = PlayerPedPreview
end)
end
OBS: previewPed is a global var
Hello,Did you succeed? I can put the code in the ox inventory ?
How do I disable the pointer that appears when I open my ped this way?
LNF_RP
July 11, 2024, 6:39pm
11
salut tu serais ou mettre le code pour l’ox_inventory ?
dans le client mais ou ?
merci d’avance pour l’aide
LNF_RP
July 12, 2024, 6:03pm
12
if you find a solution can you tell me plz i try but is hard