John Smith Posted September 19, 2014 Posted September 19, 2014 hey guys im trying to change image when my cursor enters a button's position but the image isnt changing at all and no debugscript 3 errors function buttonEnter () if source == freeRoomButton then freeRoom = nil freeRoomAnimImg = guiCreateStaticImage(500,500,675,122,"files/images/freeroam_hover.png",false,lobbyWindow) end if source == sumoButton then sumoRoom = nil sumoAnimImg = guiCreateStaticImage(500,300,675,122,"files/images/sumo_hover.png",false,lobbyWindow) end end addEventHandler( "onClientMouseEnter", getRootElement(),buttonEnter) function buttonExit () if source == freeRoomButton then freeRoomAnimImg = nil freeRoom = guiCreateStaticImage(500,500,675,122,"files/images/freeroam.png",false,lobbyWindow) end if source == sumoButton then sumoAnimImg = nil sumoRoom = guiCreateStaticImage(500,300,675,122,"files/images/sumo.png",false,lobbyWindow) end end addEventHandler( "onClientMouseLeave", getRootElement(),buttonExit) please help if you know how i could fix this edit: i have discovered by debugging that when this events work only once and then when i enter the button again it doesnt work If you find my post useful or if it helped you, please like my post Ingame name: ZoeN
Castillo Posted September 19, 2014 Posted September 19, 2014 Use guiStaticImageLoadImage San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
John Smith Posted September 19, 2014 Author Posted September 19, 2014 i tried this function buttonEnter () if source == freeRoomButton then freeRoomAnimImg = guiCreateStaticImage(500,500,675,122,"files/images/freeroam_hover.png",false,lobbyWindow) fh = guiStaticImageLoadImage(freeRoom,"files/images/freeroam_hover.png") outputDebugString("freeroam anim image") else return end if source == sumoButton then sumoAnimImg = guiCreateStaticImage(500,300,675,122,"files/images/sumo_hover.png",false,lobbyWindow) sh = guiStaticImageLoadImage(sumoRoom,"files/images/sumo_hover.png") outputDebugString("sumo anim image") else return end end addEventHandler( "onClientMouseEnter", getRootElement(),buttonEnter) function buttonExit () if source == freeRoomButton then freeRoom = guiCreateStaticImage(500,500,675,122,"files/images/freeroam.png",false,lobbyWindow) nf = guiStaticImageLoadImage(freeRoomAnimImg,"files/images/freeroam.png") outputDebugString("freeroam image") end if source == sumoButton then sumoRoom = guiCreateStaticImage(500,300,675,122,"files/images/sumo.png",false,lobbyWindow) ns = guiStaticImageLoadImage(sumoAnimImg,"files/images/sumo.png") -- line 90 outputDebugString("sumo image") end end addEventHandler( "onClientMouseLeave", getRootElement(),buttonExit) it outputs in debug that event was triggered but works only once and image doesnt change at all only error:90 bad argument guiStaticImageLoadImage (gui element is nil and idk how its nil) If you find my post useful or if it helped you, please like my post Ingame name: ZoeN
Castillo Posted September 19, 2014 Posted September 19, 2014 Thing is, you are creating the images again instead of loading a new image in the currently created ones. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
John Smith Posted September 19, 2014 Author Posted September 19, 2014 i have done this function buttonEnter () if source == freeRoomButton then --freeRoomAnimImg = guiCreateStaticImage(500,500,675,122,"files/images/freeroam_hover.png",false,lobbyWindow) fh = guiStaticImageLoadImage(freeRoom,"files/images/freeroam_hover.png") outputDebugString("freeroam anim image") else return end if source == sumoButton then --sumoAnimImg = guiCreateStaticImage(500,300,675,122,"files/images/sumo_hover.png",false,lobbyWindow) sh = guiStaticImageLoadImage(sumoRoom,"files/images/sumo_hover.png") outputDebugString("sumo anim image") else return end end addEventHandler( "onClientMouseEnter", getRootElement(),buttonEnter) function buttonExit () if source == freeRoomButton then --freeRoom = guiCreateStaticImage(500,500,675,122,"files/images/freeroam.png",false,lobbyWindow) nf = guiStaticImageLoadImage(freeRoomAnimImg,"files/images/freeroam.png") outputDebugString("freeroam image") end if source == sumoButton then --sumoRoom = guiCreateStaticImage(500,300,675,122,"files/images/sumo.png",false,lobbyWindow) ns = guiStaticImageLoadImage(sumoAnimImg,"files/images/sumo.png") outputDebugString("sumo image") end end addEventHandler( "onClientMouseLeave", getRootElement(),buttonExit) now it makes image for freeroam but doesnt remove it when i leave it, and sumo image doesnt work at all when i move my cursor to it If you find my post useful or if it helped you, please like my post Ingame name: ZoeN
John Smith Posted September 20, 2014 Author Posted September 20, 2014 Help If you find my post useful or if it helped you, please like my post Ingame name: ZoeN
Anubhav Posted September 20, 2014 Posted September 20, 2014 function buttonEnter () if source == freeRoomButton then --freeRoomAnimImg = guiCreateStaticImage(500,500,675,122,"files/images/freeroam_hover.png",false,lobbyWindow) fh = guiStaticImageLoadImage(freeRoom,"files/images/freeroam_hover.png") outputDebugString("freeroam anim image") else return end if source == sumoButton then --sumoAnimImg = guiCreateStaticImage(500,300,675,122,"files/images/sumo_hover.png",false,lobbyWindow) sh = guiStaticImageLoadImage(sumoRoom,"files/images/sumo_hover.png") outputDebugString("sumo anim image") else return end end addEventHandler( "onClientMouseEnter", getRootElement(),buttonEnter) function buttonExit () if source == freeRoomButton then freeRoom = guiCreateStaticImage(500,500,675,122,"files/images/freeroam.png",false,lobbyWindow) guiStaticImageLoadImage(freeRoom ,"files/images/freeroam.png") outputDebugString("freeroam image") end if source == sumoButton then sumoRoom = guiCreateStaticImage(500,300,675,122,"files/images/sumo.png",false,lobbyWindow) guiStaticImageLoadImage(sumoRoom ,"files/images/sumo.png") outputDebugString("sumo image") end end addEventHandler( "onClientMouseLeave", getRootElement(),buttonExit) See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
John Smith Posted September 20, 2014 Author Posted September 20, 2014 sumo image outputs in debugscript INFO: sumo image and theres no sumo anim image text when i leave the button and freeroam changes picture only ONCE and after that when i reach freeroam button it doesnt change the picture anymore edit: i have noticed that problem is that picture is being drawn over a button so i cant reach the button as image is "hiding" it but not sure how to make it that image changes when i hit gui image element If you find my post useful or if it helped you, please like my post Ingame name: ZoeN
#DRAGON!FIRE Posted September 20, 2014 Posted September 20, 2014 try this .. : addEventHandler( "onClientMouseEnter", resourceRoot, function ( ) if ( source == freeRoomButton ) then guiStaticImageLoadImage ( freeRoom, "files/images/freeroam_hover.png" ) elseif ( source == sumoButton ) then guiStaticImageLoadImage ( sumoRoom, "files/images/sumo_hover.png" ) end end ) addEventHandler( "onClientMouseLeave", resourceRoot, function ( ) if ( source == freeRoomButton ) then guiStaticImageLoadImage ( freeRoom,"files/images/freeroam.png") elseif ( source == sumoButton ) then guiStaticImageLoadImage ( sumoRoom, "files/images/sumo.png" ) end end ) To Contact Me at Skype : [email protected]
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