Bc# Posted November 1, 2012 Share Posted November 1, 2012 Trato de hacer una animacion de un logo pero no logro que me funcione este es mi codigo. function logoanimado() SpriteAnim: new( "logo.png", 0.68, 0, 0.45, 0.355, 5, 5, 30); end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), logoanimado ) y esta es la imagen: me estoy giando a partir de este post: https://forum.multitheftauto.com/viewtopic.php?f=108&t=49179 Ayuda por favor. Link to comment
NodZen Posted November 1, 2012 Share Posted November 1, 2012 Te recomiendo esto: https://wiki.multitheftauto.com/wiki/DxDrawGifImage Link to comment
Arsilex Posted November 1, 2012 Share Posted November 1, 2012 te recuerdo que estas funciones solo funcionan si es en el mismo script si cambias de resource ya no funcionan. Link to comment
Bc# Posted November 1, 2012 Author Share Posted November 1, 2012 Te recomiendo esto:https://wiki.multitheftauto.com/wiki/DxDrawGifImage Si utilizo esa funcion, ¿Tendría que usar la misma imagen del post? Link to comment
NodZen Posted November 1, 2012 Share Posted November 1, 2012 Te recomiendo esto:https://wiki.multitheftauto.com/wiki/DxDrawGifImage Si utilizo esa funcion, ¿Tendría que usar la misma imagen del post? Si. Acuerdate que tiene que ser en secuencia las imagenes. Ejemplo radar_1,radar_2,radar_3. Link to comment
Arsilex Posted November 1, 2012 Share Posted November 1, 2012 no si usas esa tienes que tener cada parte del gif en png cada imagen no se si me explico osea la del post que pusiste ariva no sirve. Link to comment
Bc# Posted November 1, 2012 Author Share Posted November 1, 2012 No entendi mucho lo de la susesion de imagenes Pero ejemplo este es mi codigo. gif = dxDrawGifImage ( 0.68, 0, 4.5, 3.55, "img/logo%", 0, "png", 60 ) addCommandHandler ( "destroygif", function ( ) destroyElement ( gif ) end ) asi me tendria que leer las imagenes que en su nombre tengan logo seguido de un numero. Ejemplo. logo1, logo2 , logo3, logo4. Link to comment
Arsilex Posted November 1, 2012 Share Posted November 1, 2012 ese es el script de la wiki no es tuyo y esta mas lee mejor Link to comment
Renkon Posted November 1, 2012 Share Posted November 1, 2012 creo que tendrías que usar exports Link to comment
Bc# Posted November 1, 2012 Author Share Posted November 1, 2012 ese es el script de la wiki no es tuyo y esta mas lee mejor Si se que es de la wiki pero esta adecuado para mi proposito, lo que pregunto se es que funcionaria Link to comment
Bc# Posted November 1, 2012 Author Share Posted November 1, 2012 creo que tendrías que usar exports Exports ¿? Link to comment
Bc# Posted November 1, 2012 Author Share Posted November 1, 2012 Este script estoy usando. gif = dxDrawGifImage ( 0.68, 0, 4.5, 3.55, "img/logo%", 13, "png", 60 ) addCommandHandler ( "destroygif", function ( ) destroyElement ( gif ) end ) pero no se si estara bien el "img/logo%" Link to comment
Castillo Posted November 1, 2012 Share Posted November 1, 2012 function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, endID = iEnd, imgID = 1, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for _, 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 gifData.imgID > gifData.endID then gifData.imgID = 1 end setElementData ( gif, "gifData", gifData ) end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) end end end ) gif = dxDrawGifImage ( 0.68, 0, 4.5, 3.55, "img/logo", 13, "png", 60 ) Link to comment
Bc# Posted November 1, 2012 Author Share Posted November 1, 2012 function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, endID = iEnd, imgID = 1, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for _, 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 gifData.imgID > gifData.endID then gifData.imgID = 1 end setElementData ( gif, "gifData", gifData ) end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) end end end ) gif = dxDrawGifImage ( 0.68, 0, 4.5, 3.55, "img/logo", 13, "png", 60 ) Lo probe y no funciona Link to comment
Arsilex Posted November 1, 2012 Share Posted November 1, 2012 function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, endID = iEnd, imgID = 1, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for _, 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 gifData.imgID > gifData.endID then gifData.imgID = 1 end setElementData ( gif, "gifData", gifData ) end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) end end end ) local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo.png", 20, 120 ) addCommandHandler ( "destroygif", function ( ) destroyElement ( gif ) end ) Link to comment
Bc# Posted November 1, 2012 Author Share Posted November 1, 2012 function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, endID = iEnd, imgID = 1, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for _, 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 gifData.imgID > gifData.endID then gifData.imgID = 1 end setElementData ( gif, "gifData", gifData ) end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) end end end ) local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo.png", 20, 120 ) addCommandHandler ( "destroygif", function ( ) destroyElement ( gif ) end ) Tampoco Funciona :C Link to comment
NodZen Posted November 1, 2012 Share Posted November 1, 2012 Tenes todos los cuadros del gif? Los agregaste al meta? Link to comment
Bc# Posted November 1, 2012 Author Share Posted November 1, 2012 si en total son 13, tambien los agrege al meta Link to comment
iFoReX Posted November 2, 2012 Share Posted November 2, 2012 yo use esta funcion una vez ( me dio mucho lagg en mi server ), yo hice esto : function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, endID = iEnd, imgID = 1, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for _, 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 gifData.imgID > gifData.endID then gifData.imgID = 1 end setElementData ( gif, "gifData", gifData ) end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) end end end ) local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo1.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo2.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo3.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo4.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo5.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo6.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo7.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo8.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo9.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo10.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo11.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo12.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo13.png", 20, 120 ) Link to comment
Castillo Posted November 2, 2012 Share Posted November 2, 2012 Porque eso que hiciste no tiene sentido, estas creando todas las imagenes como si la funcion no existiese. @Bc: La posicion debe ser absolute. Link to comment
Bc# Posted November 2, 2012 Author Share Posted November 2, 2012 yo use esta funcion una vez ( me dio mucho lagg en mi server ), yo hice esto : function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) local gifElement = createElement ( "dx-gif" ) if ( gifElement ) then setElementData ( gifElement, "gifData", { x = x, y = y, w = w, h = h, imgPath = path, endID = iEnd, imgID = 1, speed = effectSpeed, tick = getTickCount ( ) } ) return gifElement else return false end end addEventHandler ( "onClientRender", root, function ( ) local currentTick = getTickCount ( ) for _, 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 gifData.imgID > gifData.endID then gifData.imgID = 1 end setElementData ( gif, "gifData", gifData ) end dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) end end end ) local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo1.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo2.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo3.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo4.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo5.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo6.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo7.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo8.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo9.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo10.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo11.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo12.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo13.png", 20, 120 ) No anima la imagen creo que eso solo hace que salga una imagen ensima de la otra Link to comment
Bc# Posted November 2, 2012 Author Share Posted November 2, 2012 Porque eso que hiciste no tiene sentido, estas creando todas las imagenes como si la funcion no existiese.@Bc: La posicion debe ser absolute. ¿Posision absolute? Bueno yo lo de la posision es lo ultimo que queria ver pero pretendo que la imagen se plasme en la parte superior derecha de la pantalla, ¿Me podrías das un ejemplo? Link to comment
Castillo Posted November 2, 2012 Share Posted November 2, 2012 Simplemente consegui la posicion en absolute. Link to comment
Bc# Posted November 3, 2012 Author Share Posted November 3, 2012 Simplemente consegui la posicion en absolute. No entiendo a que te refieres con posision en absulute. Link to comment
Castillo Posted November 3, 2012 Share Posted November 3, 2012 Cuando usas DirectX, tenes que usar posiciones en "absolute". Una posicion absolute seria asi: 500, 500, 100, 200 Una en relative seria algo asi: 0.05, 0.8, 0.65, 0.15 Link to comment
Recommended Posts