Castillo Posted January 14, 2013 Share Posted January 14, 2013 alpha = 255 function updateAlpha ( ) alpha = ( alpha > 0 and alpha - 1 or 255 ) end setTimer ( updateAlpha, 500, 0 ) That'll decrease by 1 the alpha variable. I removed the "guiSetAlpha" because your code has no GUI elements at all, I guess is all DirectX ( DX ), so you need to use the "alpha" variable on tocolor at your drawing function. Link to comment
Malicious Hero. Posted January 14, 2013 Share Posted January 14, 2013 Well, thats not working: function changeAlpha ( commandName, alphaAmount ) alphaAmount = 255 guiSetAlpha ( RankingBoardDrawing, 255 ) setTimer ( delayedRankingBoardDrawing, 4000 ) end addCommandHandler ( "alpha", changeAlpha ) That's obviously wrong, it doesn't make any sense. Well how it would make sense? You're missing a parameter in setTimer. You have the function, and interval; but not the amount of times you wish to execute the function. Also, the command you created will completely ignore the alphaAmount portion of the syntax since you forcefully set the value of alphaAmount to 255. Also, check the post above. Link to comment
3NAD Posted January 15, 2013 Share Posted January 15, 2013 Try this. function changeAlpha ( _, alphaAmount ) if tonumber ( alphaAmount ) then guiSetAlpha ( RankingBoardDrawing, alphaAmount ) else outputChatBox ( "* Enter Correct Amount : /alpha [amount] ", 255, 0, 0, true ) end --setTimer ( delayedRankingBoardDrawing, 4000 ) end addCommandHandler ( "alpha", changeAlpha ) setTimer is Wrong ! Link to comment
Blaawee Posted January 17, 2013 Share Posted January 17, 2013 here is an example alpha = 0; screen = { guiGetScreenSize( ) }; addEventHandler( 'onClientRender', root, function( ) alpha = alpha + 30 dxDrawText( '#FF0000Bomb #FFFFFFHas Been Planted. ', screen[ 1 ] / 2, screen[ 2 ] / 2, screen[ 1 ], screen[ 2 ], tocolor ( 0, 0, 0, alpha ), 0.8, 'sa-header', 'center', 'center', false, false, true, true ) if alpha == 255 then alpha = 0 end end ) Link to comment
TAPL Posted January 17, 2013 Share Posted January 17, 2013 here is an example alpha = 0; screen = { guiGetScreenSize( ) }; addEventHandler( 'onClientRender', root, function( ) alpha = alpha + 30 dxDrawText( '#FF0000Bomb #FFFFFFHas Been Planted. ', screen[ 1 ] / 2, screen[ 2 ] / 2, screen[ 1 ], screen[ 2 ], tocolor ( 0, 0, 0, alpha ), 0.8, 'sa-header', 'center', 'center', false, false, true, true ) if alpha == 255 then alpha = 0 end end ) It i'll never be 255. 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