Currently, I am running a script of mine in which I have a NUI page, (HTML page) where I have a lot of data displayed about a user in-game. I would like to add a Ped headshot. Currently, I am able to get the ped headshot from my client-sided script however, this is a near-impossible task to style and configure as it renders under the HTML container.
Therefore, I would like to return this headshot from the client-side to JQuery and return the ped headshot as an image which I can then attach to a “div”.
The current issues I am facing right now are :
Sending the Ped Headshot to the JQuery side to return as an image.
Rendering the Ped Headshot until the menu is closed in JQuery.
I’m sorry if this is all a bit confusing, please let me know of any questions you have and I would be more than happy to answer them. Thanks for your help in advance!
We then use a Canvas, but you can likely just slap the URL into an img tag. Note I’ve cut out the part where we check if texture is an empty string, which means the script could not create a headshot, so you should add a check for that.
Hi, im using this code but the “handle” variable value is always 0
local playerPed = GetPlayerPed()
local handle = RegisterPedheadshotTransparent(playerPed)
if handle == nil or handle == 0 then
handle = RegisterPedheadshot(playerPed)
end
while not IsPedheadshotReady(handle) do
Wait(200)
end
local txd = GetPedheadshotTxdString(handle)