Jump to content

[AYUDA] Imagen Gif


Mixters

Recommended Posts

Hola, alguien me dice como puedo hacer que se repita un proceso, como por ejemplo una imagen.

Así al menos sera como una imagen gif.

¿Ayudan? :D

function Gif ( source ) 
    guiSetVisible ( imagenGif, false ) 
    imagenGif = guiCreateStaticImage(2,480,160,135,"images/1.png",false) 
    setTimer ( Gif, 1000, 1 ) 
end 
function Gif2 ( source ) 
    guiSetVisible ( imagenGif, false ) 
    imagenGif = guiCreateStaticImage(305,119,250,190,"images/2.png",false) 
    setTimer ( Gif2, 1000, 1 ) 
end 
function Gif3 ( source ) 
    guiSetVisible ( imagenGif, false ) 
    imagenGif = guiCreateStaticImage(305,119,250,190,"images/3.png",false) 
    setTimer ( Gif3, 1000, 1 ) 
end 
function Gif4 ( source ) 
    guiSetVisible ( imagenGif, false ) 
    imagenGif = guiCreateStaticImage(305,119,320,81,"images/4.png",false) 
    setTimer ( Gif4, 3000, 1 ) 
end 
function StopGif( source ) 
    guiSetVisible ( Gif, false ) 
end 
addCommandHandler ( "pararGif", Gif) 

Lo que quiero es que inicie en 1.png y termine en 4.png

Link to comment

Bueno mira , el ejemplo si se entiende , es asi:

sWidth, sHeight = guiGetScreenSize() 
  
function dxDrawGifImage ( x, y, w, h, path, iStart, iType, effectSpeed ) 
    local gifElement = createElement ( "dx-gif" ) 
    if ( gifElement ) then 
        setElementData ( 
            gifElement, 
            "gifData", 
            { 
                x = x, 
                y = y, 
                w = w, 
                h = h, 
                imgPath = path, 
                startID = iStart, 
                imgID = iStart, 
                imgType = iType, 
                speed = effectSpeed, 
                tick = getTickCount ( ) 
            } 
        ) 
        return gifElement 
    else 
        return false 
    end 
end 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local currentTick = getTickCount ( ) 
        for index, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do 
            local gifData = getElementData ( gif, "gifData" ) 
            if ( gifData ) then 
                if ( currentTick - gifData.tick >= gifData.speed ) then 
                    gifData.tick = currentTick 
                    gifData.imgID = ( gifData.imgID + 1 ) 
                    if ( fileExists ( gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) ) then 
                        gifData.imgID = gifData.imgID 
                        setElementData ( gif, "gifData", gifData ) 
                    else 
                        gifData.imgID = gifData.startID 
                        setElementData ( gif, "gifData", gifData ) 
                    end 
                end 
                dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) 
            end 
        end 
    end 
) 
  
gif = dxDrawGifImage ( 1200, 5, 70, 80, "images/Frame", 0, "png", 50 )-- Esto Si probà. El 50 es la velocidad , cuanto menos es mas rapida. 
  

Link to comment

Tuve el mismo problema que tu mira este post quizás te ayude algo.

https://forum.multitheftauto.com/viewtopic.php?f=145&t=49665

Si no te queda claro te dejo esto

function dxDrawGifImage ( x, y, w, h, path, iStart, iType, effectSpeed ) 
    local gifElement = createElement ( "dx-gif" ) 
    if ( gifElement ) then 
        setElementData ( 
            gifElement, 
            "gifData", 
            { 
                x = x, 
                y = y, 
                w = w, 
                h = h, 
                imgPath = path, 
                startID = iStart, 
                imgID = iStart, 
                imgType = iType, 
                speed = effectSpeed, 
                tick = getTickCount ( ) 
            } 
        ) 
        return gifElement 
    else 
        return false 
    end 
end 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local currentTick = getTickCount ( ) 
        for index, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do 
            local gifData = getElementData ( gif, "gifData" ) 
            if ( gifData ) then 
                if ( currentTick - gifData.tick >= gifData.speed ) then 
                    gifData.tick = currentTick 
                    gifData.imgID = ( gifData.imgID + 1 ) 
                    if ( fileExists ( gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) ) then 
                        gifData.imgID = gifData.imgID 
                        setElementData ( gif, "gifData", gifData ) 
                    else 
                        gifData.imgID = gifData.startID 
                        setElementData ( gif, "gifData", gifData ) 
                    end 
                end 
                dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) 
            end 
        end 
    end 
) 
  
gif = dxDrawGifImage ( 769, 175, 193, 145, "images/img", 1, "png", 120 ) 

Prueba con eso pero renombra las imagenes dentro de la carpeta o no funcionara.

Ponles:

img1

img2

img3

img4

PD: Tus imagenes deven ser de igual tamaño o se vera mal.

Link to comment
algún ejemplo que visualice 2 imágenes al menos ?, creo que solo así lograre entender. :?

Ese ejemplo te sirve para la cantidad de imágenes que quieras.

Lo único que tienes que tener en cuenta es que devén llamarse:

img1

img2

..

..

..

..

img100

o hasta la cantidad de imagenes que tengas.

PD: Almenos, ¿has probado el script?

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...