KiffShark Posted December 12, 2012 Share Posted December 12, 2012 (edited) Hi This is the first time I try to add a "gif" so I've found this and I'm not sure what I'm doing wrong Please somebody can help me? I want put a gif (by sprites..) in the hud but it doesn't spawn.. sw,sh are defined... it works for all modded hud. the files are 1rad.png, 2rad.png ..... 31rad.png (they are added in meta) gif = dxDrawGifImage ( sw*0.92,sh*0.15,sh*0.04,sh*0.04, "%srad.png", 0, "png", 120 ) I don't know what is wrong, I haven't put any gif before some idea? Thanks! Edited December 12, 2012 by Guest 1 Link to comment
denny199 Posted December 12, 2012 Share Posted December 12, 2012 Because dxDrawGifImage is a usefull function put this in your code: 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 ) 1 Link to comment
Blaawee Posted December 12, 2012 Share Posted December 12, 2012 change the images name to : rad1.png, rad2.png ..... rad31.png and change this : gif = dxDrawGifImage ( sw*0.92,sh*0.15,sh*0.04,sh*0.04, "%srad.png", 0, "png", 120 ) To gif = dxDrawGifImage ( sw*0.92,sh*0.15,sh*0.04,sh*0.04, "rad", 1, "png", 120 ) 1 Link to comment
KiffShark Posted December 12, 2012 Author Share Posted December 12, 2012 Thanks!!! Solved =D *O* thanks! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now