Sometimes you often find the animation is stuck / bugs on your server / people, until you immigration and relog. Here's an example to solve the stuck animation.
RegisterCommand("animfix", function(source, args, rawCommand)
local ped = GetPlayerPed(-1)
local isDead = false
if not IsEntityInAir(ped) then
if not IsPedRagdoll(ped) then
if not IsPedInAnyVehicle(ped) then
ClearPedTasksImmediately(ped)
ClearPedSecondaryTask(ped)
SetPedCanPlayGestureAnims(ped, true)
else
exports['gusti-notify']:SendAlert('inform', 'You can\'t use this command while you\'re in a car.', 3000)
end
else
exports['gusti-notify']:SendAlert('inform', 'You can\'t use this command if you\'re not standing.', 3000)
end
else
exports['gusti-notify']:SendAlert('inform', 'You can\'t use this command if you\'re in the air.', 3000)
end
end, false)
CreateThread(function()
TriggerEvent('chat:addSuggestion', '/animfix', 'Use this command if your animation gets bugged. It will stop your animation and save you.')
end)