Advertisement
lowheartrate

cancel animation

May 1st, 2019
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. Citizen.CreateThread( function()
  2.  
  3.     while true do
  4.         Citizen.Wait(0)
  5.         -- hands up animation
  6.         if (IsControlJustPressed(0,handsUpButton))  then
  7.             local ped = PlayerPedId()
  8.    
  9.             if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then
  10.    
  11.                 RequestAnimDict( "random@mugging3" )
  12.    
  13.                 while ( not HasAnimDictLoaded( "random@mugging3" ) ) do
  14.                     Citizen.Wait( 100 )
  15.                 end
  16.    
  17.                 if IsEntityPlayingAnim(ped, "random@mugging3", "handsup_standing_base", 3) then
  18.                     ClearPedSecondaryTask(ped)
  19.                 else
  20.                     TaskPlayAnim(ped, "random@mugging3", "handsup_standing_base", 2.0, 2.5, -1, 49, 0, 0, 0, 0 )
  21.                     local prop_name = prop_name
  22.                     local secondaryprop_name = secondaryprop_name
  23.                     DetachEntity(prop, 1, 1)
  24.                     DeleteObject(prop)
  25.                     DetachEntity(secondaryprop, 1, 1)
  26.                     DeleteObject(secondaryprop)
  27.                 end
  28.                
  29.             end
  30.         end
  31.        
  32.         -- cancel animations
  33.         if (IsControlJustPressed(0,cancelAnimation))  then
  34.             local ped = PlayerPedId()
  35.             if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then
  36.                 radioActive = false
  37.                 ClearPedSecondaryTask(ped)
  38.                
  39.                 DetachEntity(prop, 1, 1)
  40.                 DeleteObject(prop)
  41.                 DetachEntity(secondaryprop, 1, 1)
  42.                 DeleteObject(secondaryprop)
  43.             end
  44.  
  45.         end
  46.     end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement