RedM
  • 🇫🇷Home
  • 🧑‍🌾Ambient NPC
  • ⛺Campement
  • 🃏Card Collection
  • ♟️Chess & Checkers Game
  • 💣Dynamite
  • 🙋Environment animations
  • 🔥Fire sync
  • 🐎Feeding Horse + Syringe
  • 🚭Illicit Sales
  • ⚖️Instances
  • 📥Market Stall
  • 🩺Medical Records
  • 🍲Metabolism
  • 🗣️Mumble Block UI
  • ⏸️Pause Menu
  • ⌨️Quick Keys Menu
  • 💵Reward Loyalty and Total playtime
  • 🖋️Tattoo
  • 🥇Top Serveurs
  • ⚰️Undertaker
  • 💀Wanted
  • 🔫Weapon Cleaning Animation
  • 🏹Weapon Rack
Powered by GitBook
On this page

Environment animations

Client Side

Client exports

exports.bt_interaction:ResearchInteraction()
  • This function allows you to initiate a search for NPC animations present in the area.

  • If you are transformed into an animal (e.g. bear, horse, deer, donkey, etc.), then it will display potentially compatible animations for you.

  • As a human or an animal, the displayed animations may not necessarily be executable for various reasons.

Client function and variable (config.lua)

currentAnimation(String animModel, String animName)
  • This function returns the model and name of the animation that is currently being played by the player.

Boolean IsPlayingAnimation
  • This boolean variable is set to TRUE when the player is playing the animation and it is set to FALSE as soon as the player stops or changes the animation

Code example :

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 working
            TriggerServerEvent("redem:GiveMeWater") -- example, not working
         end
      end
   end
 end)
end

Here is an excerpt from the config.lua file : (parts of the excerpt are hidden)

Config = {
    enable_command              = true, -- enable command
    botiv_interaction_cmd       = "interact", -- command name
    enable_control              = true, -- enable InteractControl and InteractAnimalControl for research animation
    InteractControl             = 0x760A9C6F, -- G
    InteractMode                = "press", -- "hold", "press"
    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               = {} -- this content is hidden in the excerpt 

function currentAnimation(animModel, animName)
-- Return current animation model and animation name. (you can use variable playerIsPlayingAnimation)
    -- Example for giving water when player using water pump
Citizen.CreateThread(function()
        while playerIsPlayingAnimation do
            Citizen.Wait(0)
            if animModel == "Hidden" or animModel == "Hidden" then
                if GetGameTimer()%500 == 0 then
                    SendNotification(animName .. " gave you water + 1")
                    TriggerServerEvent("vorp:GiveMeWater") -- not working
                    TriggerServerEvent("redem:GiveMeWater") -- not working
                end
            end
        end
    end)
end

-- this content is hidden in the excerpt

Last updated 11 months ago

🙋