Adding to the radial menu

  1. Hi, I’m using the ez_radialmenu script and I would like to add different animations to it, such as amb_camp@world_camp_fire_sit_ground@male_c@idle_a, script_shows@firebreather@act2_p1, WORLD_HUMAN_SMOKE, etc. What code should I use to trigger these animations? I added something like this, but it doesn’t work very well only a few animations work. Can anyone advise what I should add to main.lua so that all of them work?
-- UNIVERSAL EVENT FOR ALL TYPES OF ANIMATIONS
RegisterNetEvent('ez_radialmenu:client:playUniversalAnim', function(data)
local ped = PlayerPedId()
if not data then
    print("Error: No animation data provided")
    return
end

ClearPedTasks(ped)

if data.scenario then
    TaskStartScenarioInPlace(ped, data.scenario, 0, true)
    print("Playing scenario: " .. data.scenario)
elseif data.dict and data.anim then
    if not HasAnimDictLoaded(data.dict) then
        RequestAnimDict(data.dict)
        local timeout = 5000
        local startTime = GetGameTimer()
        while not HasAnimDictLoaded(data.dict) do
            if GetGameTimer() - startTime > timeout then
                print("Animation dictionary load timeout: " .. data.dict)
                return
            end
            Wait(10)
        end
    end
    local flags = data.flags or 1
    TaskPlayAnim(ped, data.dict, data.anim, 1.0, 1.0, -1, flags, 1, false, false, false, 0, true)
    print("Playing animation: " .. data.dict .. "/" .. data.anim)
elseif data.emote then
    TaskEmote(ped, 0, 2, joaat(data.emote), true, true, true, true, true)
    print("Playing emote: " .. data.emote)
else
    print("Error: Invalid animation data")
    return
end

if data.duration then
    Citizen.CreateThread(function()
        Wait(data.duration)
        ClearPedTasks(ped)
    end)
end
end)
  1. [05:54]
Config.MenuItems = {
    {
        id = 'general',
        title = 'Ogólne',
        image = 'wheel.png',
        items = {
            {
                id = 'emote',
                title = 'Emotki',
                icon = "face-smile",
                type = 'command',
                event = 'emotemenu',
                shouldClose = true,
            },
        }
    },
    -- NOWA SEKCJA ANIMACJE - DODAJ TUTAJ
    {
        id = 'animations',
        title = 'Animacje',
        image = 'person-running.png', -- lub inna ikona
        items = {
            {
                id = 'smoke',
                title = 'Zapal papierosa',
                icon = 'smoking',
                type = 'client',
                event = 'ez_radialmenu:client:playUniversalAnim',
                scenario = 'WORLD_HUMAN_SMOKE',
                shouldClose = true,
            },
            {
                id = 'camp_fire',
                title = 'Siedzenie przy ognisku',
                icon = 'campground',
                type = 'client',
                event = 'ez_radialmenu:client:playUniversalAnim',
                dict = 'amb_camp@world_camp_fire_sit_ground@male_c@idle_a',
                anim = 'idle_a',
                flags = 1,
                duration = 10000,
                shouldClose = true,
            },
                        {
                id = 'ce_fire',
                title = 'najebany',
                icon = 'campground',
                type = 'client',
                event = 'ez_radialmenu:client:playUniversalAnim',
                dict = 'script_shows@firebreather@act2_p1',
                anim = 'idle_a',
                flags = 1,
                duration = 10000,
                shouldClose = true,
            },

        }
    },
    {

(edytowane)

  1. [05:55]

For example, the last animation doesn’t work anymore, but the first two still do.