Leo Messi Posted July 11, 2018 Share Posted July 11, 2018 (edited) local imgTable = { {"LV - Hospital", 652, 131, 10, 9}, {"LV - DM Area", 608, 93, 10, 9}, } for index, imgTable in ipairs(imgTable) do blipImg = guiCreateStaticImage(imgTable[2], imgTable[3], imgTable[4], imgTable[5], "images/1.png", false, mapImg) addEventHandler("onClientGUIClick", blipImg, onClickBlip, false) end function onClickBlip() local x, y = guiGetPosition(blipImg, false) for index, blips in ipairs(imgTable) do if x == blips[2] and y == blips[3] then if (blipImage2) then destroyElement(blipImage2) end blipImage2 = guiCreateStaticImage(blips[2], blips[3], blips[4], blips[5], "images/2.png", false, mapImg) end end end So okay, everything is working but I want it, once I click any icon it will be replaced with another icon on its place, look at my code Edited July 11, 2018 by Leo Messi Link to comment
Leo Messi Posted July 12, 2018 Author Share Posted July 12, 2018 Guys, if you just can't help say 'I can't help' Atleast I don't wait for nothing Link to comment
Galactix Posted July 12, 2018 Share Posted July 12, 2018 (edited) I can't help, sorry On a more serious note, just try to wait for someone experienced to see your topic and actually give you a hint or a solution to your problem Edited July 12, 2018 by Galactix Link to comment
kieran Posted July 12, 2018 Share Posted July 12, 2018 You'll need to first create a function before the GUI is created. Now use GuiGetPosition to get the position of the image clicked (in your new function the image will be the source that triggered it), after this you just destroy the image (in new function) like this: destroyElement (source) Why create a function BEFORE the GUI is made I hear you ask? Well the way a computer reads code is top to bottom, so if you try pass a function, boolean or variable before it knows that it's there, it will get confused and say it's not there. Simple! Now that you have got the position of that image when you clicked it (remember you need "x,y = guiGetPosition (source)"), you can create your new image there. If you need an example I can try (please try yourself first), but I am very lazy today. Also please use these for code '<>' it helps us see your code more clearly as it is colored, just like in notepad++. I hope this helps you! Link to comment
Leo Messi Posted July 13, 2018 Author Share Posted July 13, 2018 Thank you bro, it worked. 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