Cocodrilo Posted May 3, 2013 Share Posted May 3, 2013 I am trying to make a spawn menu. I use "guiStaticImageLoadImage" to change one image for another one.. but i need use "onClientGUIClick" in a image(which are constantly changing) to add a "triggerServerEvent" and finally use "spawnPlayer" in Server-side. please anyone can help me with the function? local screenWidth, screenHeight = guiGetScreenSize() local windowWidth, windowHeight = 661, 528 local left = (screenWidth-windowWidth)/2 local top = (screenHeight-windowHeight)/2 PANEL = guiCreateWindow(left,top,windowWidth,windowHeight, "", false) guiWindowSetSizable(PANEL, false) showCursor( true ) BANNER = guiCreateStaticImage(9, 18, 642, 163, ":guieditor/images/examples/shruk.png", false, PANEL) LEFT = guiCreateStaticImage(190, 350, 26, 23, "left.png", false, PANEL) RIGHT = guiCreateStaticImage(440, 350, 26, 23, "right.png", false, PANEL) LABEL = guiCreateStaticImage(150, 173, 400, 64, "label.png", false, PANEL) BOTONLEFT = guiCreateButton(190, 350, 26, 23, "", false, PANEL) guiSetAlpha(BOTONLEFT, 0.0) BOTONIMAGEN = guiCreateButton(225, 242, 208, 219, "", true, PANEL) guiSetAlpha(BOTONIMAGEN, 0.0) IMAGENRICK = guiCreateStaticImage(225, 242, 208, 219, "1.png", false, PANEL) BOTONRIGHT = guiCreateButton(440, 350, 26, 23, "", false, PANEL) guiSetAlpha(BOTONRIGHT, 0.0) local images = { "1.png","2.png","3.png","4.png","5.png","6.png","7.png","8.png" } local id = 1 addEventHandler("onClientGUIClick", BOTONRIGHT, function ( ) if id then id = id + 1 else id = id - 1 end if id < 1 then id = #images end if id > #images then id = 1 end guiStaticImageLoadImage ( IMAGENRICK , images [ id ] ) end,false ); local images = { "1.png","2.png","3.png","4.png","5.png","6.png","7.png","8.png" } local id = 1 Link to comment
فاّرس Posted May 3, 2013 Share Posted May 3, 2013 Try it : Pic = guiCreateStaticImage(230,30,134,289,"1.png",false); Button = guiCreateButton(254,163,113,46,"",false) images = {"1.png","2.png","3.png"} addEventHandler("onClientGUIClick",root, function () if (source == Button) then for _,Image in ipairs(images) do guiStaticImageLoadImage (Pic,Image); end end end) Link to comment
Cocodrilo Posted May 3, 2013 Author Share Posted May 3, 2013 Try it : Pic = guiCreateStaticImage(230,30,134,289,"1.png",false); Button = guiCreateButton(254,163,113,46,"",false) images = {"1.png","2.png","3.png"} addEventHandler("onClientGUIClick",root, function () if (source == Button) then for _,Image in ipairs(images) do guiStaticImageLoadImage (Pic,Image); end end end) Works thank you ! 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