Ped not rotating

Hello, I am trying to create a ped that spawns and just stands in one place with an leaning animation. I am having issues with rotating the ped correctly, it doesn’t seem to respond to SetEntityHeading(), any suggestions ? Here is my code :

local spawnPos = vector3(83.77, -1974.1, 20.93)

RegisterCommand(‘createPed’, function(_, _, args)
local hash = GetHashKey(‘a_m_m_soucent_03’)
while not HasModelLoaded(hash) do
RequestModel(hash)
Wait(20)
end
local ped = CreatePed(‘PED_TYPE_CIVFEMALE’, ‘a_m_m_soucent_03’, spawnPos.x, spawnPos.y, spawnPos.z, -90, false, false)
SetEntityInvincible(ped, true)
Wait(1000)
SetEntityHeading(ped, 40)
print(‘Working’)
print(GetEntityHeading(ped))
FreezeEntityPosition(ped, true)
TaskStartScenarioInPlace(ped, ‘WORLD_HUMAN_LEANING’, 0, true)
SetBlockingOfNonTemporaryEvents(ped, true)
end)

1 Like

Try setting the heading like this, as SetEntityHeading requires a float value:

SetEntityHeading(ped, 40.0)
1 Like

THANKS !!! It solved my issue

1 Like

No problem, glad to help!

For future reference, if a native doesn’t seem to be working, you can check to see what the parameter requires through the native documentation.

An example below using AddBlipForRadius and ClearPedProp

-- ADD_BLIP_FOR_RADIUS
local retval --[[ Blip ]] =
	AddBlipForRadius(
		posX --[[ number ]], 
		posY --[[ number ]], 
		posZ --[[ number ]], 
		radius --[[ number ]]
	)

Since it defines the parameter for posX as a “number” (float, double, all fall under this) you would need to use a decimal place number like 0.0.

-- CLEAR_PED_PROP
ClearPedProp(
	ped --[[ Ped ]], 
	propId --[[ integer ]]
)

Since propId is defined as a “integer”, you would need to use a flat number like 0.

I hope you have a great time developing!

1 Like

Thanks, now I understand the difference between number and integer :smile:, you have a great time developing too !

1 Like