jamelnassar Posted October 30, 2013 Posted October 30, 2013 hello gys i want to make the gui hide in 3 second i want to change alpha actilly Image = guiCreateStaticImage( 690, 200, 100, alpha, "R1.png", false ) local Alpha = 255 - o local o = 0.1 i dont know why it doesnt work can someone fix it
Castillo Posted October 30, 2013 Posted October 30, 2013 You mean keep lowering the alpha until it's fully invisible?
Desaster Posted October 30, 2013 Posted October 30, 2013 local alpha1 = 255 local alpha2 = 0 Image = guiCreateStaticImage( 690, 200, 100, alpha, "R1.png", false ) function setalpha() setTimer ( function() guiSetAlpha(Image, alpha2) end, 3000, 1 ) end
jamelnassar Posted October 31, 2013 Author Posted October 31, 2013 yes soildsnake desaster it doesnt work
xXMADEXx Posted October 31, 2013 Posted October 31, 2013 If you are trying to make a fade effect, i'd recommend using dxDrawImage so that you can just declare the alpha to a variable, and every render you can lower the alpha. Example: local alpha = 255 addEventHandler ( "onClientRender", root, function ( ) dxDrawImage ( 690, 200, 100, "R1.png", 0, 0, 0, tocolor ( 255, 255, 255, alpha ) ) if ( alpha > 25 ) then alpha = alpha - 1 end end )
denny199 Posted October 31, 2013 Posted October 31, 2013 You guys are doing serveral things wrong. When using guiSetAlpha alpha: The visibility/transparency of the GUI element. Ranges from 0 (fully transparent) to 1 (fully opaque). And you are using guiCreateStaticImage and dxDrawImage wrong, it only has screenX, screenY, Width, and no height! So: local alpha = 255 addEventHandler ( "onClientRender", root, function ( ) dxDrawImage ( 690, 200, 100, 100, "R1.png", 0, 0, 0, tocolor ( 255, 255, 255, alpha ) ) -- starts at 690 pixels from the Xscreen -- then starts at 200 pixels from the Y --draw is 100 pixels to the X ( width ) --and 100 pixels to the Y ( height ) if ( alpha > 25 ) then alpha = alpha - 1 end end ) OR: local alpha = 1 Image = guiCreateStaticImage( 690, 200, 100, 100, "R1.png", false ) addEventHandler ( "onClientRender", root, function ( ) if ( alpha >= 0 ) then alpha = alpha - 0.1 guiSetAlpha ( Image, alpha ) end end)
jamelnassar Posted October 31, 2013 Author Posted October 31, 2013 it doesnt work i use server file not client i need server code
tosfera Posted October 31, 2013 Posted October 31, 2013 If you want to display it for every user in the game, you should loop through it using the getElementsByType.
denny199 Posted October 31, 2013 Posted October 31, 2013 If you want to display it for every user in the game, you should loop through it using the getElementsByType. That doesn't make any sense If you put it on client side, then it will execute if the client's pc has loaded the client script.
WASSIm. Posted October 31, 2013 Posted October 31, 2013 use this guiSetProperty guiSetProperty( theImage, "Alpha", Alpha )
.:HyPeX:. Posted October 31, 2013 Posted October 31, 2013 If you want to display it for every user in the game, you should loop through it using the getElementsByType. That doesn't make any sense If you put it on client side, then it will execute if the client's pc has loaded the client script. It does, you loop the elements that are players and send to each one's client-side the trigger. (correctly setup should work, but i would rather use the player variable than all elements, but still should work)
WASSIm. Posted November 1, 2013 Posted November 1, 2013 What's wrong with guiSetAlpha? guiSetAlpha not working with GUI Static Images
denny199 Posted November 1, 2013 Posted November 1, 2013 What's wrong with guiSetAlpha? guiSetAlpha not working with GUI Static Images You are wrong, it's working. The values are from 0 to 1, like I said earlier before. If you want to display it for every user in the game, you should loop through it using the getElementsByType. That doesn't make any sense If you put it on client side, then it will execute if the client's pc has loaded the client script. It does, you loop the elements that are players and send to each one's client-side the trigger. (correctly setup should work, but i would rather use the player variable than all elements, but still should work) So you want to loop all players on the server side and then trigger X amount of players to the client, so if you have 50 players on your server, you are sending 50 times a trigger to the client??? Better use "root" instead.
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