sausage123 Posted May 22, 2016 Posted May 22, 2016 (edited) local screenW, screenH = guiGetScreenSize() function window() Kicks = isMouseWithinRangeOf(screenW * 0.6676, screenH * 0.1719, screenW * 0.0974, screenH * 0.0495) if Kicks then dxDrawRectangle(screenW * 0.6676, screenH * 0.1719, screenW * 0.0974, screenH * 0.0495, tocolor(255, 255, 255, 255), false) else dxDrawRectangle(screenW * 0.6676, screenH * 0.1719, screenW * 0.0974, screenH * 0.0495, tocolor(255, 167, 15, 255), false) end end addEventHandler("onClientRender", root, window) function click(playerSource) kick = isMouseWithinRangeOf(screenW * 0.6676, screenH * 0.1719, screenW * 0.0974, screenH * 0.0495) if kick then triggerServerEvent("KicKPlayer", getLocalPlayer()) end end addEventHandler("onClientClick",getRootElement(),click) function isMouseWithinRangeOf(psx,pssx,psy,pssy) if not isCursorShowing() then return false end local cx,cy = getCursorPosition() cx,cy = cx*screenW,cy*screenH if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then return true,cx,cy else return false end end Edited May 24, 2016 by Guest
Gravestone Posted May 24, 2016 Posted May 24, 2016 dxDrawRectangle is used to draw a rectangle only, you can't make a function when the player clicks on it. Use GUI function instead.
ViRuZGamiing Posted May 24, 2016 Posted May 24, 2016 dxDrawRectangle is used to draw a rectangle only, you can't make a function when the player clicks on it. Use GUI function instead. You can capture clicks on dx elements by checking the mouse click position compaired to the dx element's position. Example; https://forum.multitheftauto.com/viewto ... 91&t=88456
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