DakiLLa Posted January 19, 2009 Posted January 19, 2009 Hi. I want to make a smooth opening and closing gui menus. I know that i need to use guiGetAlpha and guiSetAlpha but i dont know how to use it correctly. Can you help me with small example or just tell what i need to do. thx
Gamesnert Posted January 19, 2009 Posted January 19, 2009 setTimer(guiSetAlpha,100,10,theGUI,guiGetAlpha(theGUI)/255+0.1) (although it seems weird with guiGetAlpha returning between 0 and 255, while guiSetAlpha only seem to work between 0 and 1... ) Or use the example HERE.
DakiLLa Posted January 19, 2009 Author Posted January 19, 2009 ehm, i have made something, but no result..where i have mistakes ? g_res_root = getResourceRootElement ( getThisResource () ) addEventHandler ( "onClientResourceStart", g_res_root, function () x, y = guiGetScreenSize () p_wnd = guiCreateWindow ( x-280, y-600, 243, 164, "test", false ) close () end ) function close ( ) local currentAlpha = guiGetAlpha ( p_wnd ) local newAlpha = currentAlpha - 4 if newAlpha < 0 then newAlpha = 0 end guiSetAlpha ( p_wnd, newAlpha ) if newAlpha ~= 0 then setTimer ( open, 50, 1, p_wnd ) end end
Gamesnert Posted January 19, 2009 Posted January 19, 2009 g_res_root = getResourceRootElement ( getThisResource () ) addEventHandler ( "onClientResourceStart", g_res_root, function () x, y = guiGetScreenSize () p_wnd = guiCreateWindow ( x-280, y-600, 243, 164, "test", false ) close () end ) function close ( ) local currentAlpha = guiGetAlpha ( p_wnd ) local newAlpha = currentAlpha - 4 if newAlpha < 0 then newAlpha = 0 end guiSetAlpha ( p_wnd, newAlpha ) if newAlpha ~= 0 then setTimer ( close, 50, 1, p_wnd ) end end Try this? You put open in the timer while there's no open.
DakiLLa Posted January 19, 2009 Author Posted January 19, 2009 oh..i just forgot edit word "open" of word "close" in editinig my post.. doesnt help all the same..
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