Adding animations to esx_doorlock

Hey there!
I’m using the latest version of esx_doorlock by qalle.
I would like to ask how would I go on about adding animations to the script?

Hi @Hedwig I don’t really answer these all too often so hopefully I can do it some justice!

My approach would be to use a fiveM native reference called: TASK_START_SCENARIO_IN_PLACE TASK_START_SCENARIO_IN_PLACE(Ped ped, char* scenarioName, int unkDelay, BOOL playEnterAnim)

I would trigger this right after the IsControlJustReleased (when the door is being locked or unlocked)

You can learn more about that native reference here if you are interested: (Gotta love FiveM Docs!)

client/main.lua (around line: 96)

local playerPed = PlayerPedId() -- Gotta grab the player ped ID.

if IsControlJustReleased(0, 38) then

                    if v.isAuthorized then

                        TaskStartScenarioInPlace(playerPed, 'CODE_HUMAN_MEDIC_TEND_TO_DEAD', 0, true) -- A random animation I chose.

                        v.locked = not v.locked

                        TriggerServerEvent('esx_doorlock:updateState', k, v.locked) -- broadcast new state of the door to everyone

                    end

                end

            end

        end

        if letSleep then

            Citizen.Wait(500)

        end

    end

end)

Anyways, I hope this helped… at least a little bit. Good luck out there. :slight_smile: :slight_smile:

1 Like

Wow!
Thank you very much for your response and for using some of your time to introducing me to all of this. This is exactly what I was looking for :smiley:
I’m fascinated with what people can do in this community.
Hopefully, this is the start of my “developing” journey.
I will look into the native references and hopefully get some understanding of it.
Thank you very much and have a great day!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.