undefined Posted June 9, 2014 Share Posted June 9, 2014 Hi Guys. Im work on the help panel. I tried to make the opening of the panel to be transparent. But the "R" Nothing happens when I press the button. Also its not give error and warning on debugscript. Im how to make the transparent opening? function open() if (guiGetVisible (helpMenu) == true) then if guiGetAlpha(helpMenu) >= 65 then setTimer(function() if not guiGetAlpha(helpMenu) <= 0 then guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)-5)) end end,50,0) guiSetVisible(helpMenu, false) showCursor(false) end elseif (guiGetVisible (helpMenu) == false) then if guiGetAlpha(helpMenu) <= 0 then setTimer(function() if not guiGetAlpha(helpMenu) >= 65 then guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)+5)) end end,50,0) guiSetVisible(helpMenu, true) showCursor(true) end end end bindKey ("R", "down", open) Link to comment
Memory Posted June 9, 2014 Share Posted June 9, 2014 Try local timer; function open() if (guiGetVisible (helpMenu) == true) then if isTimer ( timer ) then killTimer ( timer ) end timer = setTimer(function() if not guiGetAlpha(helpMenu) <= 0 then guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)-5)) else guiSetVisible(helpMenu, false) showCursor(false) killTimer(timer) end end,50,0) elseif (guiGetVisible (helpMenu) == false) then if isTimer ( timer ) then killTimer ( timer ) end timer = setTimer(function() if not guiGetAlpha(helpMenu) >= 65 then guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)+5)) else guiSetVisible(helpMenu, true) showCursor(true) killTimer(timer) end end,50,0) end end bindKey ("R", "down", open) Link to comment
Den. Posted June 9, 2014 Share Posted June 9, 2014 Read the wiki guiSetAlpha. The alpha given to this function should range from 0 to 1. Link to comment
undefined Posted June 9, 2014 Author Share Posted June 9, 2014 Try local timer; function open() if (guiGetVisible (helpMenu) == true) then if isTimer ( timer ) then killTimer ( timer ) end timer = setTimer(function() if not guiGetAlpha(helpMenu) <= 0 then guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)-5)) else guiSetVisible(helpMenu, false) showCursor(false) killTimer(timer) end end,50,0) elseif (guiGetVisible (helpMenu) == false) then if isTimer ( timer ) then killTimer ( timer ) end timer = setTimer(function() if not guiGetAlpha(helpMenu) >= 65 then -- Line 85 guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)+5)) else guiSetVisible(helpMenu, true) showCursor(true) killTimer(timer) end end,50,0) end end bindKey ("R", "down", open) It's not work..! ; Link to comment
#DRAGON!FIRE Posted June 9, 2014 Share Posted June 9, 2014 P.S : u can use function ( setAlphaGradually ) for all GUI Elements . setAlphaGradually = function( element, Speed ) if ( isElement( element ) and getElementType( element ):find( "gui-" ) and tonumber( Speed ) and tonumber( Speed ) >= 50 ) then if ( isTimer( Timer ) ) then killTimer( Timer ) end guiSetAlpha ( element, 0 ) Timer = setTimer ( function ( ) guiSetAlpha ( element, guiGetAlpha ( element ) + 0.03 ) if ( guiGetAlpha ( element ) == 1 ) then killTimer( Timer ) end end, Speed, 0 ) else return false end end bindKey( "R", "down", function( ) setAlphaGradually( helpMenu, 70 ) guiSetVisible( helpMenu, not guiGetVisible( helpMenu ) ) showCursor( guiGetVisible( helpMenu ) ) end ) Link to comment
xXMADEXx Posted June 10, 2014 Share Posted June 10, 2014 Is the MTA Forum becoming the new Twittter or something? Link to comment
Memory Posted June 10, 2014 Share Posted June 10, 2014 local timer; function open() if (guiGetVisible (helpMenu) == true) then if isTimer ( timer ) then killTimer ( timer ) end timer = setTimer(function() if not guiGetAlpha(helpMenu) <= 0 then guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)-0.05)) else guiSetVisible(helpMenu, false) showCursor(false) killTimer(timer) end end,50,0) elseif (guiGetVisible (helpMenu) == false) then if isTimer ( timer ) then killTimer ( timer ) end guiSetVisible(helpMenu, true) guiSetAlpha(helpMenu, 0) timer = setTimer(function() if not guiGetAlpha(helpMenu) >= 0.65 then -- Line 85 guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)+0.05)) else showCursor(true) killTimer(timer) end end,50,0) end end bindKey ("R", "down", open) Link to comment
undefined Posted June 10, 2014 Author Share Posted June 10, 2014 local timer; function open() if (guiGetVisible (helpMenu) == true) then if isTimer ( timer ) then killTimer ( timer ) end timer = setTimer(function() if not guiGetAlpha(helpMenu) <= 0 then guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)-0.05)) else guiSetVisible(helpMenu, false) showCursor(false) killTimer(timer) end end,50,0) elseif (guiGetVisible (helpMenu) == false) then if isTimer ( timer ) then killTimer ( timer ) end guiSetVisible(helpMenu, true) guiSetAlpha(helpMenu, 0) timer = setTimer(function() if not guiGetAlpha(helpMenu) >= 0.65 then -- Line 85 guiSetAlpha(helpMenu, (guiGetAlpha(helpMenu)+0.05)) else showCursor(true) killTimer(timer) end end,50,0) end end bindKey ("R", "down", open) It's not work. It's solved. Thank you # ZĀ!ـحF ๛..! 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