Advertisement
TheBakkeseKing

Animaciones

Aug 30th, 2024
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.36 KB | None | 0 0
  1.  
  2.     local animacionesCaer = {
  3.       [1] = {"ped", "ko_shot_stom", -1, true, true, false, true},
  4.       [2] = {"crack", "ko_shot_face"},
  5.       [3] = {"crack", "ko_spin_r"},
  6.       [4] = {"crack", "ko_skid_front"},
  7.     }
  8.     function gestionarAnimacion(source, group, animacion, time, loop, updatePosition, interruptable, freezeLastFrame)
  9.       local varDataSource = exports["MR1_Inicio"]:getValueOne(source)
  10.       if varDataSource.Estado["Taseado"] == true then
  11.         return
  12.       end
  13.       iprint(source, group, animacion, time, loop, updatePosition, interruptable, freezeLastFrame)
  14.       time = time or -1               -- Duración de la animación (por defecto infinito)
  15.       if loop == nil then loop = true end       -- Repetir animación (por defecto true)
  16.       updatePosition = updatePosition or false  -- Mover el jugador con la animación (por defecto false)
  17.       interruptable = interruptable or false    -- Hacer la animación no interrumpible (por defecto false)
  18.       if freezeLastFrame == nil then freezeLastFrame = true end -- Congelar el último frame (por defecto true)
  19.  
  20.         if not animacionesJugadores[source] then
  21.             -- Iniciar la animación
  22.             animacionesJugadores[source] = {group, animacion}
  23.             iprint(source, group, animacion, time, loop, updatePosition, interruptable, freezeLastFrame)
  24.             setPedAnimation(source, group, animacion, time, loop, updatePosition, interruptable, freezeLastFrame)
  25.             triggerClientEvent(source, "syncAnimacion", source, group, animacion)
  26.         else
  27.             -- Detener la animación
  28.             animacionesJugadores[source] = nil
  29.             setPedAnimation(source, false)
  30.             triggerClientEvent(source, "syncAnimacion", source, false)
  31.         end
  32.     end
  33.     function Caer(source, command, id)
  34.       local idAnim = tonumber(id)
  35.       local cantidadAnimaciones = #animacionesCaer
  36.       if idAnim and animacionesCaer[idAnim] then
  37.         local group, animacion, time, loop, updatePosition, interruptable, freezeLastFrame = unpack(animacionesCaer[idAnim])
  38.         gestionarAnimacion(source, group, animacion, time, loop, updatePosition, interruptable, freezeLastFrame)
  39.       else
  40.         gestionarAnimacion(source, nil, nil)
  41.         outputChatBox("#FF0000Uso incorrecto. Usa: /caer [1-"..cantidadAnimaciones.."]", source, 255, 255, 255, true)
  42.       end
  43.     end
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement