πŸ™‹Environment animations

🟦 Client Side

πŸ”Œ Exports

  • Search for Area Animations:

    exports.bt_interaction:ResearchInteraction()

    This function scans for available NPC animations in your current area.

    • If you are transformed into an animal (bear, horse, deer, donkey, etc.), it will show potentially compatible animations for your current animal form.

    • As a human or animal, the displayed animations may not always be executable, depending on game constraints.

πŸ“ Functions & Variables

  • Get Current Animation:

    currentAnimation(animModel, animName)

    Returns the model and name of the animation currently played by the player.

  • Animation State Boolean:

    IsPlayingAnimation
    • true when the player is playing an animation.

    • false as soon as the player stops or changes animation.

Example Usage

function currentAnimation(animModel, animName)
    Citizen.CreateThread(function()
        while playerIsPlayingAnimation do
            Citizen.Wait(0)
            if animModel == "PROP_HUMAN_PUMP_WATER_BUCKET" or animModel == "PROP_HUMAN_PUMP_WATER" then
                if GetGameTimer() % 500 == 0 then
                    SendNotification(animName .. " gave you water + 1")
                    TriggerServerEvent("vorp:GiveMeWater") -- (example, not implemented here)
                    TriggerServerEvent("redem:GiveMeWater") -- (example, not implemented here)
                end
            end
        end
    end)
end

βš™οΈ Configuration Example (config.lua)

Config = {
    enable_command           = true,                 -- Enable the interaction command
    botiv_interaction_cmd    = "interact",           -- Command name
    enable_control           = true,                 -- Enable control for animation research
    InteractControl          = 0x760A9C6F,           -- (G key)
    InteractMode             = "press",              -- Use "press" or "hold" for activation
    Interaction_human_input  = "Press G to stop the animation.",
    InteractAnimalControl    = 0xE7EB9185,           -- (WhistleHorseBack)
    Interaction_animal_input = "Press H to stop the animation.",
    Interaction_stop_msg     = "Cancel animation",
    Menu_title               = "Animations",
    Menu_subtitle            = "Environment",
    Play_msg                 = "Play animation :",
    Exit_msg                 = "Close",
    AnimationList            = { ... }               -- See config for the full list
}

πŸ“Œ Notes

  • Command Activation: The interaction menu is enabled by default and can be triggered with the configured command/key (default: G for humans, H for animals).

  • Menu & Controls: Prompts, menu titles, and animation labels are all customizable in config.lua.

  • Advanced: You can hook into currentAnimation and IsPlayingAnimation for gameplay, roleplay, or server event logic.

Last updated