FuriouZ Posted October 4, 2013 Share Posted October 4, 2013 Hey I have one very stupit problem.. i'm getting so sick to fix it, i tryed like 3hours to fix price of this shit, but still nothing .. --PICTURES function drawWorldGui() GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) showCursor(true) --'FREEROAM' GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamEnter.png", true, GUIEditor.staticimage[1]) --(picture 2) --'Selected' GUIEditor.staticimage[3] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3) guiSetVisible(GUIEditor.staticimage[3], false) GUIEditor.button[1] = guiCreateButton(0.105, 0.335, 0.20, 0.28, "", true, GUIEditor.staticimage[1]) guiSetProperty(GUIEditor.button[1], "AlwaysOnTop", "True") guiSetAlpha(GUIEditor.button[1], 0.5) addEventHandler( "onClientMouseEnter",GUIEditor.button[1], FreeroamEnter) addEventHandler("onClientMouseLeave",GUIEditor.button[1],FreeroamLeave) end addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) function FreeroamEnter () guiSetVisible(GUIEditor.staticimage[3], true); guiSetVisible(GUIEditor.staticimage[2], false); end function FreeroamLeave () guiSetVisible(GUIEditor.staticimage[2], true); guiSetVisible(GUIEditor.staticimage[3], false); end If my cursor is on button, then should appear image with freeroam tag (pic 2) , but if i go to the button, then image dissapears.. fucking shit .. hope you understand Link to comment
Moderators Citizen Posted October 5, 2013 Moderators Share Posted October 5, 2013 (edited) I would proceed like this: function drawWorldGui() GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) showCursor(true) --'Normal state' GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3) addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) end addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) function FreeroamEnter () guiStaticImageLoadImage( , "img/thumbs/FreeroamEnter.png" ) --'Hover state' end function FreeroamLeave () guiStaticImageLoadImage( , "img/thumbs/FreeroamLeave.png" ) --'Normal state' end So I only use 1 static image and then I just change the image displayed in that static image with guiStaticImageLoadImage. and I can add the two events ("onClientMouseEnter" and "onClientMouseLeave") on the correct element (which is the GUIEditor.staticimage[2]) (you added those events on the button you created and that is not needed at all) Should work but you still need to do the click detection but I guess you will do it well. Best regards, Citizen Edited October 5, 2013 by Guest Link to comment
FuriouZ Posted October 5, 2013 Author Share Posted October 5, 2013 Doesn't work, says line 13 & 17 have unexpected symbol near "," function drawWorldGui() GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) showCursor(true) --'Normal state' GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3) addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) end addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) function FreeroamEnter () guiStaticImageLoadImage( , "img/thumbs/FreeroamEnter.png" ) --'Hover state' end function FreeroamLeave () guiStaticImageLoadImage( , "img/thumbs/FreeroamLeave.png" ) --'Normal state' end Link to comment
iPrestege Posted October 5, 2013 Share Posted October 5, 2013 function drawWorldGui() GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) showCursor(true) --'Normal state' GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3) addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) end addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) function FreeroamEnter () guiStaticImageLoadImage( source, "img/thumbs/FreeroamEnter.png" ) --'Hover state' end function FreeroamLeave () guiStaticImageLoadImage( source, "img/thumbs/FreeroamLeave.png" ) --'Normal state' end Link to comment
FuriouZ Posted October 5, 2013 Author Share Posted October 5, 2013 function drawWorldGui() GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) showCursor(true) --'Normal state' GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3) addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) end addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) function FreeroamEnter () guiStaticImageLoadImage( source, "img/thumbs/FreeroamEnter.png" ) --'Hover state' end function FreeroamLeave () guiStaticImageLoadImage( source, "img/thumbs/FreeroamLeave.png" ) --'Normal state' end It can't be "source" .. It happens .. Link to comment
FuriouZ Posted October 5, 2013 Author Share Posted October 5, 2013 Fixed it finally ! Thanks to all who tryed to help me [EDIT]: I still have one question, if i click to the backround image (GUIEditor.staticimage[1]), then i can't use buttons anymore, what are created on it How to fix it ? Link to comment
iPrestege Posted October 5, 2013 Share Posted October 5, 2013 function drawWorldGui() GUIEditor.staticimage[1] = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "img/backround.png", true) showCursor(true) --'Normal state' GUIEditor.staticimage[2] = guiCreateStaticImage(0.08, 0.30, 0.25, 0.35, "img/thumbs/FreeroamLeave.png", true, GUIEditor.staticimage[1]) --(picture 1 & 3) addEventHandler( "onClientMouseEnter", GUIEditor.staticimage[2], FreeroamEnter) addEventHandler( "onClientMouseLeave", GUIEditor.staticimage[2], FreeroamLeave) end addEventHandler("onClientResourceStart", resourceRoot,drawWorldGui) function FreeroamEnter () guiStaticImageLoadImage( source, "img/thumbs/FreeroamEnter.png" ) --'Hover state' end function FreeroamLeave () guiStaticImageLoadImage( source, "img/thumbs/FreeroamLeave.png" ) --'Normal state' end It can't be "source" .. It happens .. No you can make it source . Read this part from the wiki : The source of this event is the GUI element that was pointed at. Good Luck! Link to comment
Moderators Citizen Posted October 5, 2013 Moderators Share Posted October 5, 2013 Oh yeah sorry my bad, I forgot to finish that part, so yeah Mr.Pres[T]ege finished my work by adding source for the 1st argument but it also could be GUIEditor.staticimage[2] like this: function FreeroamEnter () guiStaticImageLoadImage( GUIEditor.staticimage[2], "img/thumbs/FreeroamEnter.png" ) --'Hover state' end function FreeroamLeave () guiStaticImageLoadImage( GUIEditor.staticimage[2], "img/thumbs/FreeroamLeave.png" ) --'Normal state' end That's exactly the same because GUIEditor.staticimage[2] will always be the source of this event. For the baground problem, just set the property "AlwaysOnTop" for the staticimage[2]: guiSetProperty( GUIEditor.staticimage[2], "AlwaysOnTop" ) That should do the trick. Sorry again for that mistake. Best regards, Citizen 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