Jump to content

[HELP] Looping through images


..:D&G:..

Recommended Posts

local images ={ 
    "Main/files/images/menu_bg1.jpg", 
    "Main/files/images/menu_bg2.jpg", 
    "Main/files/images/menu_bg3.jpg", 
    "Main/files/images/menu_bg4.jpg", 
    "Main/files/images/menu_bg5.jpg", 
    "Main/files/images/menu_bg6.jpg" 
} 
local ap = 0 
local id = 1 
local tick = getTickCount() 
local function setId() 
    id = id + 1  
    if id >= #images then  
        id = 1  
    end  
     
    tick = getTickCount () + 3000 
end  
setTimer (setId, 5000, 1) 
  
function fade ()  
    if ap >= 255 then  
        if getTickCount () >= tick then 
            ap = ap - 5 
        end  
    else 
        ap = ap + 5 
    end  
end  
  
function testBackground() 
    fade()   
    dxDrawImage(s[1]*0/1440,s[2]*0/900, s[1]*1440/1440,s[2]*900/900, images[id], 0, 0, 0, tocolor(255, 255, 255, ap),false) 
end 
addEventHandler ("onClientRender", root, testBackground) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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