task sequences are pretty neat
RegisterCommand("dance",function(source, args)
local ad1 = "anim@amb@nightclub@dancers@crowddance_facedj@"
local ad2 = "anim@amb@nightclub@dancers@club_ambientpedsfaces@"
local player = GetPlayerPed( -1 )
if ( DoesEntityExist( player ) and not IsEntityDead( player )) then
loadAnimDict(ad1)
loadAnimDict(ad2)
if ( IsEntityPlayingAnim( player, ad2, "mood_dancing_medium_4", 3 ) ) then
ClearPedTasks(player)
else
local _, sequence1 = OpenSequenceTask(0)
TaskPlayAnim(player, ad2, "mood_dancing_medium_4", 8.0, -8.0, -1, 33, 0.0, 0, 0, 0)
SetSequenceToRepeat(sequence1, 1)
CloseSequenceTask(sequence1)
TaskPerformSequence(player, sequence1)
ClearSequenceTask(sequence1)
local _, sequence = OpenSequenceTask(0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_15_v2_female^1", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_15_v2_female^2", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_15_v2_female^3", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_15_v2_female^4", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_15_v2_female^5", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_15_v2_female^6", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_17_v2_female^1", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_17_v2_female^2", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_17_v2_female^3", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_17_v2_female^4", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_17_v2_female^5", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
TaskPlayAnim(0, ad1, "hi_dance_facedj_17_v2_female^6", 8.0, -8.0, -1, 0, 0.0, 0, 0, 0)
SetSequenceToRepeat(sequence, 1)
CloseSequenceTask(sequence)
TaskPerformSequence(player, sequence)
ClearSequenceTask(sequence)
Wait (500)
end
end
end, false)
function loadAnimDict(dict)
while (not HasAnimDictLoaded(dict)) do
RequestAnimDict(dict)
Citizen.Wait(5)
end
end
entering the command again cancels it so enjoy