i have made login with dx and when i use normal screen positions for dx function works good after that i have added function guiGetScreenSize() to dx got wrong positions and wrong hover colors for dx Text
here's my code
help
local msX, msY = 1280,1024
local sX, sY = guiGetScreenSize()
function isMouseWithinRangeOf(x1,y1,x2,y2,type)
if not isCursorShowing() then
return false
end
local cx,cy = getCursorPosition()
cx,cy = cx*sX,cy*sY
if cx >= x1 and cx <= (type == true and x2 + x1 or x2) and cy >= y1 and cy <= (type == true and y2 + y1 or y2) then
return true,cx,cy
else
return false
end
end
function renderDxLogin()
if isTransferBoxActive() then return end
if isPlayerLoggedin() then
hideLoginDX()
return
end
if isPanelVisible then
if not isCursorShowing() then
showCursor(true)
end
if isChatVisible() then
showChat(false)
end
end
if isMouseWithinRangeOf(324, 485, 182, 57, true)then r, g, b = 255, 100, 100 elseif isMouseWithinRangeOf(sX-713, sY-539, 748, 541, true) then r1, g1, b1 = 255, 100, 100 elseif isMouseWithinRangeOf(sX-489, sY-539, 972, 541) then r2, g2, b2 = 255, 100, 100 else r, g, b = 255, 255, 255 end
dxDrawRectangle(sX-956, sY-773, 658, 220, tocolor(0, 0, 0, 150), false)
dxDrawBorderedText(welcomemsg, sX-958, sY-828, 982, 247, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
dxDrawText("Username : ", sX-951, sY-730, 500, 325, tocolor(255, 255, 255, 255), 0.90, "bankgothic", "left", "top", false, false, false, false, false)
dxDrawText("Password :", sX-951, sY-682, 500, 373, tocolor(255, 255, 255, 255), 0.90, "bankgothic", "left", "top", false, false, false, false, false)
DxDrawBorderedRectangle(sX-956, sY-539, 181, 56, tocolor(0, 0, 0, 150), false)
DxDrawBorderedRectangle(sX-713, sY-539, 181, 56, tocolor(0, 0, 0, 150), false)
DxDrawBorderedRectangle(sX-489, sY-539, 181, 56, tocolor(0, 0, 0, 150), false)
--dxDrawBorderedText("Login", sX-956, sY-539, 505, 541, tocolor(r,g, b, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
dxDrawBorderedText("Login", (323 / msX) * sX, (539 / msY) * sY, 505, 541, tocolor(r,g, b, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
dxDrawBorderedText("Register", sX-713, sY-539, 748, 541, tocolor(r1,g1, b1, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
dxDrawBorderedText("Updates", sX-489, sY-539, 972, 541, tocolor(r2,g2, b2, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
--(567 / nX) * sX, (433 / nY) * sY 323, 485
end
addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY)
if not isPanelVisible then return end
if button ~= "left" then return end
if state ~= "down" then return end
if isMouseWithinRangeOf((323 / msX) * sX, (539 / msY) * sY, 505, 541, true) then
triggerServerEvent("onPlayerLoginSuccess", localPlayer , guiGetText(edit[1]),guiGetText(edit[2]))
elseif isMouseWithinRangeOf(sX-713, sY-539, 748, 541, true) then
triggerServerEvent("onPlayerRegisterSuccess", localPlayer, guiGetText(edit[1]),guiGetText(edit[2]))
end
end)
i know i didn't put all variables of my script almost of them are true