I’m new to FiveM, trying a basic script to play an animation when the player presses “M”, the trace is displayed in F8 but the animation doesn’t play, where am I going wrong? Thanks. Please point out any mistakes/bad practice also.
function animPlay(who)
Citizen.Trace("Playing Animation")
TaskPlayAnim(who, "amb@code_human_cower_stand@male@base", "base", 8.0, 0.0, -1, 0, 1.0, 0, 0, 0)
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if(IsControlJustPressed(0, 244)) then
animPlay(GetPlayerPed(-1))
end
end
end)
so progress is the animation plays, I had to call the dictionary with RequestAnimDict, now how to get out of the animation? Both the StopAnim options aren’t working, the only way to cancel the animation is by ClearPedTasksImmediately which cuts off the animation and doesn’t look fluid.
function animPlay(who)
RequestAnimDict("amb@code_human_cower_stand@male@base")
Citizen.Trace("Playing Animation")
TaskPlayAnim(who, "amb@code_human_cower_stand@male@base", "base", 8.0, 0.0, -1, 0, 1.0, 0, 0, 0)
Citizen.Wait("5000")
Citizen.Trace("Stopping Animation")
--StopAnimTask(who, "amb@code_human_cower_stand@male@base", "base")
--StopAnimPlayback(who, 0, 0)
ClearPedTasksImmediately(who)
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if(IsControlJustPressed(0, 244)) then
animPlay(GetPlayerPed(-1))
end
end
end)