[Code Snippet] Fix Animasi

Sometimes you often find animations stuck / bugs on your server / people, until you immigration and relog, here’s an example to overcome stuck animations.

Create a client.lua file and add the code below

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['mythic_notify']:SendAlert('inform', 'You can\'t use this command while you\'re in a car.', 6500)
            end
        else
            exports['mythic_notify']:SendAlert('inform', 'You can\'t use this command if you\'re not standing.', 6500)
        end
    else
        exports['mythic_notify']:SendAlert('inform', 'You can\'t use this command if you\'re in the air.', 6500)
    end

end, false)

Citizen.CreateThread(function()
    TriggerEvent('chat:addSuggestion', '/animfix', 'Use this command if your animation gets bugged. It will stop your animation and save you.')
end)

More Code Snippet :

Hi @Gustiagung,

Is this supposed to be a guide/tutorial? If so, you’ve posted it in the wrong section + added the incorrect tags. In the future, create all your guides/tutorials in the following sections:

Post all your server related guides/tutorials here
Post all your mod related guides/tutorials here

Hi @eazy_mods
I think this is correct where I posted it, and the people who shared the code snippet also posted it here

@Gustiagung If you’re trying to help/guide people about something, it makes more sense to put it in the corresponding guides section that I’ve linked.

You won’t be penalised for putting it here, but only those looking for help on their specific issue usually post here so to help maximise your audience/reach - I’d recommend posting in the guides section where people are looking for tutorials/guides to read as it’d be unfortunate if you put in so much effort into something and people don’t even come across it :slight_smile:

@eazy_mods I tried to see the part you showed me to post there, but I see no tag showing that it’s a code snippet :slightly_smiling_face: