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