Leo Messi Posted August 10, 2018 Share Posted August 10, 2018 So simple and easy, I want to make something like; for example; I created an icon (static image) and if I clicked near this image it will add event on it like onClientGUIClick and get a message with 'You clicked on x image' for example. Just like CIT rapid transportation map to be clear. Link to comment
knightscript Posted August 11, 2018 Share Posted August 11, 2018 9 hours ago, Leo Messi said: So simple and easy, I want to make something like; for example; I created an icon (static image) and if I clicked near this image it will add event on it like onClientGUIClick and get a message with 'You clicked on x image' for example. Just like CIT rapid transportation map to be clear. You could create a PNG image thats bigger than the original one with transparency, have an onclick for it Link to comment
Leo Messi Posted August 11, 2018 Author Share Posted August 11, 2018 On 8/10/2018 at 21:41, knightscript said: You could create a PNG image thats bigger than the original one with transparency, have an onclick for it Good idea, but wastes time and I already made it before I need something new Link to comment
knightscript Posted August 11, 2018 Share Posted August 11, 2018 1 hour ago, Leo Messi said: Good idea, but wastes time and I already made it before I need something new You could use onClientClick to get the position in the screen in combination with GuiGetScreenSize (to calculate the relative screen position) Link to comment
Leo Messi Posted August 11, 2018 Author Share Posted August 11, 2018 On 8/11/2018 at 00:47, knightscript said: You could use onClientClick to get the position in the screen in combination with GuiGetScreenSize (to calculate the relative screen position) Any example? Link to comment
knightscript Posted August 11, 2018 Share Posted August 11, 2018 Just now, Leo Messi said: Any example? Forgive me, I wasnt at home, I will work on an example and I will send it to you, i will use 1920x1080 and make calculations there, theoretically if I do it relative it should work on any res, i will update my comment when its ready. 1 Link to comment
LilDawage Posted August 11, 2018 Share Posted August 11, 2018 wut i sould use : 1- onClientClick 2- getElementByType 3- getDistanceBetweenPoints3D 4- onClientClick use >>> witch panel you want to open it like function menu () , so you make it ... any help pm me on dc thank you Link to comment
Leo Messi Posted September 10, 2018 Author Share Posted September 10, 2018 Any another idea? Link to comment
sFxMTA Posted September 10, 2018 Share Posted September 10, 2018 (edited) Umh, i maybe didn't understood well but i'll try to explain what i figured out... You could store the whole data in an array and use them with onClientKey, like: function Example (button, pressOrRelease) if not pressOrRelease then return end if isMouseInPosition ( Array[0],Array[1],Array[2],Array[3] ) then outputChatBox("You clicked on X image") end end addEventHandler("onClientKey", root, Example) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end Don't blame me if that's not what you needed, that's just what i understood and i'm trying to help... Edited September 10, 2018 by XisH 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