itHyperoX Posted March 16, 2017 Share Posted March 16, 2017 (edited) Hi, i made a weaponshop it working full dxdraw. The problem is, when i click on my screen, but i'm not in the weaponshop marker i can buy a weapons from there. addEventHandler("onClientClick", root, function(key, state, cx, cy) if key == "left" and state == "down" then if isCursorInBox(screenW * 0.3302, screenH * 0.3500, screenW * 0.0620, screenH * 0.0370) then triggerServerEvent("giveM4",getLocalPlayer(),giveM4) end end end) addEventHandler("onClientClick", root, function(key, state, cx, cy) if key == "left" and state == "down" then if isCursorInBox(screenW * 0.5333, screenH * 0.5667, screenW * 0.0344, screenH * 0.0296) then removeEventHandler("onClientPreRender", getRootElement(), draw) showCursor(false) end end end) function isCursorInBox(left, top, width, height) if isCursorShowing() then cursorX, cursorY = getCursorPosition() cursorX, cursorY = cursorX*screenW, cursorY*screenH if cursorX >= left and cursorX <= left+width and cursorY >= top and cursorY <= top+height then return true end else return false end addEventHandler("onClientMarkerHit", shopmarker, function (p) if p == localPlayer then addEventHandler("onClientPreRender", getRootElement(), draw) showCursor(true) end end ) So. What i need to do, only the clicks work, when i'm on the marker ? If need, i can post the full client side. Edited March 16, 2017 by TheMOG Link to comment
3aGl3 Posted March 16, 2017 Share Posted March 16, 2017 You have to check if the menu is currently visible. Just create a variable for that and check it in the onClientClick events. Link to comment
itHyperoX Posted March 16, 2017 Author Share Posted March 16, 2017 (edited) fixed thanks @3aGl3 Edited March 16, 2017 by TheMOG 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