Xwad Posted October 25, 2016 Posted October 25, 2016 The text appears succesfully but i cant make it disappear:/ Pls help! [lua] function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ( "D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) setTimer ( function() startTick = nil,nil removeEventHandler("onClientRender",root,text) local currentTick = getTickCount() local progress = (currentTick+startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ( "D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) end, 8000, 1 ) end [/lua]
Walid Posted October 25, 2016 Posted October 25, 2016 You can use a timer to remove the event handler local duration = 5000 local x,y = guiGetScreenSize() function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) setTimer (function() removeEventHandler("onClientRender",root,text) end,8000,1) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ("D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) end or check if the alpha == 255 then remove the event handler like this local duration = 5000 local x,y = guiGetScreenSize() function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ( "D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) if tonumber(alpha) == 255 then removeEventHandler("onClientRender",root,text) end end Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
Xwad Posted October 26, 2016 Author Posted October 26, 2016 (edited) No, my problem is not with the simple disappear. My problem is that i cant make it disappear with the alpha effect. like this, but its not workin local x,y = guiGetScreenSize() local duration = 1500 function fadeDX() startTick = getTickCount() addEventHandler("onClientRender",root,text) setTimer (function() removeEventHandler("onClientRender",root,text) addEventHandler("onClientRender",root,text2) end,3000,1) end function text() local currentTick = getTickCount() local progress = (currentTick-startTick)/duration local alpha = interpolateBetween(0,0,0,255,0,0,progress,"InOutQuad") dxDrawText ("D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha), 3) end function text2() alpha = 255 dxDrawText ("D-Day", x/2.05, y/3, x, y, tocolor(255, 255, 255, alpha-5), 3) end Edited October 26, 2016 by Xwad
!#NssoR_) Posted October 26, 2016 Posted October 26, 2016 Bro, if u wanna put lua functions please use : To be able to read it easily.
Xwad Posted October 26, 2016 Author Posted October 26, 2016 ohhokay thanks. I am just a littlebit confused with the new forum. The oldone was with [ ]
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