Beluga Posted November 9, 2010 Posted November 9, 2010 bindKey ("m","down", function(key,state) if (guiGetVisible (gameWindow) == false) then guiSetVisible (gameWindow,true) showCursor (true,true) else guiSetVisible (gameWindowWindow,false) showCursor (false,false) end end end) I got his code now. If I press "M" it shows "gameWindow" but I was searching on the wiki and couldn't find anything about slowly fade in. So my question is: Somebody can help me with making this: If I press "M" the "gameWindow" slowly fade in and when I press again it slowly fade out again. P.s I tried something with guiGetAlpha and guiSetAlpha but It didn't helped. function openMenu() local menu = guiGetVisible(gameWindow) if menu == false then local currentAlpha = guiGetAlpha(gameWindow) local newAlpha = currentAlpha - 4 if newAlpha < 0 then newAlpha = 0 end guiSetAlpha(gameWindow,newAlpha) if newAlpha ~= 0 then setTimer(openMenu, 50, 1) end elseif menu == true then local currentAlpha = guiGetAlpha(gameWindow) local newAlpha = currentAlpha + 4 if newAlpha > 255 then newAlpha = 255 end guiSetAlpha(gameWindow,newAlpha) if newAlpha ~= 255 then setTimer(openMenu,50,1) end end end bindKey("m","down",openMenu)
Aibo Posted November 9, 2010 Posted November 9, 2010 https://wiki.multitheftauto.com/wiki/GuiSetAlpha Required Arguments * guiElement: the GUI element whose visibility is to be changed * alpha: The visibility/transparency of the GUI element. Ranges from 0 (fully transparent) to 1 (fully opaque). ?
Beluga Posted November 10, 2010 Author Posted November 10, 2010 Hmm I checked it but I don't really how to use it to slowly fade in/out.
Aibo Posted November 10, 2010 Posted November 10, 2010 well, first thing is you have to put 0-1 range instead of 0-255 for alpha (btw. someone have to fix this wiki example ). second, changing alpha will not set GUI element visible if it's not, visibility and alpha are independent properties. ?
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