ZueiraPlays Posted August 18, 2013 Share Posted August 18, 2013 Someone can help me? I did five icons (name_2,_3,_4,_5 and _6). They should change in every level, but do not work. Example: --food r,g,b = 0,255,0 local food = getElementData(getLocalPlayer(),"food")*2.55 r,g,b = 255-food,food,0 if food < 20 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_2.png",0,0,0,tocolor(r,g,b,fading)) elseif food < 40 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_3.png",0,0,0,tocolor(r,g,b)) elseif food < 60 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_4.png",0,0,0,tocolor(r,g,b)) elseif food < 80 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_5.png",0,0,0,tocolor(r,g,b)) elseif food == 100 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_6.png",0,0,0,tocolor(r,g,b)) end Link to comment
iPrestege Posted August 19, 2013 Share Posted August 19, 2013 Could you please post the whole code. Link to comment
ZueiraPlays Posted August 19, 2013 Author Share Posted August 19, 2013 Could you please post the whole code. Here: fading = 0 fading2 = "up" local screenWidth,screenHeight = guiGetScreenSize() function updateIcons () if getElementData(getLocalPlayer(),"logedin") then --fading if fading >= 0 and fading2 == "up" then fading = fading + 5 elseif fading <= 255 and fading2 == "down" then fading = fading - 5 end --fading math. if fading == 0 then fading2 = "up" elseif fading == 255 then fading2 = "down" end --food r,g,b = 0,255,0 local food = getElementData(getLocalPlayer(),"food")*2.55 r,g,b = 255-food,food,0 if food < 20 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_2.png",0,0,0,tocolor(r,g,b,fading)) elseif food < 40 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_3.png",0,0,0,tocolor(r,g,b)) elseif food < 60 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_4.png",0,0,0,tocolor(r,g,b)) elseif food < 80 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_5.png",0,0,0,tocolor(r,g,b)) elseif food == 100 then dxDrawImage ( screenWidth*0.94 , screenHeight*0.925, screenHeight*0.085, screenHeight*0.085, "icons/food_6.png",0,0,0,tocolor(r,g,b)) end end addEventHandler ( "onClientRender", getRootElement(), updateIcons ) 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