How to use SET_PED_HEAD_OVERLAY?


#1

Good afternoon everyone I’m trying to use SET_PED_HEAD_OVERLAY but they are not working could someone help me?


#2

This would be interesting, a time ago I had tried do this, but didn’t find anything on http://docs.fivem.net/ and I decided let this a side


#3
// 0x48F44967FA05CC1E 0xD28DBA90
// SetPedHeadOverlay
void SET_PED_HEAD_OVERLAY(Ped ped, int overlayID, int index, float opacity);

I’m following this and it’s not working.


#4

If you don’t show how you use it, we can’t help you


#5

SetPedHeadOverlay(playerPed, 1, 4,1.0) ?


#6

Yes, should works


#7

It is not working, the other sets work, except the one that does not


#8

Do you use it on MP model? Because I don’t think it works on AI ped.

Otherwise, show your script, we need to see how you use it to help.


#9

I use MP Male

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(10)
		    if IsControlPressed(1, 23)   then	--only test
			local playerPed = GetPlayerPed(-1)
--SET_PED_COMPONENT_VARIATION(Ped ped, int componentId, int drawableId, int textureId, int paletteId)
	 SetPedComponentVariation(playerPed, 0, 0, 0, 2) --face
	 SetPedComponentVariation(playerPed, 2, 20, 4, 2) --hair
	 SetPedComponentVariation(playerPed, 4, 1, 5, 2) -- legs
	 SetPedComponentVariation(playerPed, 6, 1, 0, 2) -- under
	 SetPedComponentVariation(playerPed, 11, 7, 2, 2) -- jack
	 SetPedHeadOverlay(playerPed, 1, 4,1.0) --beard
	 SetPedPropIndex(playerPed, 0, 46, 0, 0)
        end
    end
end)

#10

Ok, maybe because you need to apply a color on your overlay.

This is my function to change head overlay:

function ChangeOverlay(overlayId, value, opacity, color)
	Citizen.CreateThread(function()
		SetPedHeadOverlay(GetPlayerPed(-1), overlayId, value, opacity)
		if(overlayId == 1 or overlayId == 10 or overlayId == 2) then
			SetPedHeadOverlayColor(GetPlayerPed(-1), overlayId, 1, color, color)
		elseif (overlayId == 5 or overlayId == 8) then
			SetPedHeadOverlayColor(GetPlayerPed(-1), overlayId, 2, color, color)
		else
			SetPedHeadOverlayColor(GetPlayerPed(-1), overlayId, 0, color, color)
		end
	end)
end

More info: https://runtime.fivem.net/doc/natives/#_0x497BF74A7B9CB952


#11

I’ll try, thanks.


#12
> Citizen.CreateThread(function()
>     while true do
>         Citizen.Wait(10)
> 		    if IsControlPressed(1, 23)   then	--only test
> 			local playerPed = GetPlayerPed(-1)
> --SET_PED_COMPONENT_VARIATION(Ped ped, int componentId, int drawableId, int textureId, int paletteId)
> 	 SetPedComponentVariation(playerPed, 0, 0, 0, 2) --face
> 	 SetPedComponentVariation(playerPed, 2, 20, 4, 2) --hair
> 	 SetPedComponentVariation(playerPed, 4, 1, 5, 2) -- legs
> 	 SetPedComponentVariation(playerPed, 6, 1, 0, 2) -- under
> 	 SetPedComponentVariation(playerPed, 11, 7, 2, 2) -- jackPreformatted text
> 	  SetPedHeadOverlay(playerPed, 1, 16, 0.99)
> 	  SetPedHeadOverlayColor(playerPed, 1, 16, 5, 5)
> 	 SetPedPropIndex(playerPed, 0, 46, 0, 0)
>         end
>     end
> end)

did not work


#13

You reverse overlayid and colorType:

SetPedHeadOverlayColor(playerPed, 1, 16, 5, 5)
--to
SetPedHeadOverlayColor(playerPed, 16, 1, 5, 5)

#14

nothing happened


#15

My bad, 16 isn’t overlayId but overlayIndex, should be good:

SetPedHeadOverlayColor(playerPed, 1, 1, 5, 5)

#17

nothing happened, why will not it be working?


#18

I’m not at home, so I can’t test it. Currently, I don’t have any idea why it’s not working. I’ll test it when I could :wink:


#19

Thanks, when I can test I’ll be expecting <3, but I’ll try here


#20

Ok I found a solution:

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(10)
        if IsControlPressed(1, 23) then	--only test
            local playerPed = GetPlayerPed(-1)
            SetPedHeadBlendData(playerPed, 0, 0, 0, 0, 0, 0, 0.5, 0.5, 0, true)
    		while HasPedHeadBlendFinished(playerPed) do
    			Citizen.Wait(0)
    		end
            --SET_PED_COMPONENT_VARIATION(Ped ped, int componentId, int drawableId, int textureId, int paletteId)
            SetPedComponentVariation(playerPed, 0, 0, 0, 2) --face
            SetPedComponentVariation(playerPed, 2, 20, 4, 2) --hair
            SetPedComponentVariation(playerPed, 4, 1, 5, 2) -- legs
            SetPedComponentVariation(playerPed, 6, 1, 0, 2) -- under
            SetPedComponentVariation(playerPed, 11, 7, 2, 2) -- jackPreformatted text
            SetPedHeadOverlay(playerPed, 1, 16, 0.99)
            SetPedHeadOverlayColor(playerPed, 1, 1, 5, 5)
            SetPedPropIndex(playerPed, 0, 46, 0, 0)
        end
    end
end)

It didn’t work because of head blend data, I don’t know why but if someone have the answer :slight_smile:


#21

I tested here and nothing has changed ‘-’