Jump to content

Help (What is the problem?)


XomoXX

Recommended Posts

Hello! I have a script but i dont understand what is the problem.

heres the code:
 

fadeCamera(true, 0.3)
setCameraMatrix(2410.69263, -1657.63013, 40.17338, 2442.47388, -1658.73975, 27.61846)

setPlayerHudComponentVisible("all",false)
setPlayerHudComponentVisible("crosshair",false)

showCursor(true)

local screenX,screenY = guiGetScreenSize();
local loginPanelX,loginPanelY;
local joinTick;
local margin = getResponsiveSize(10)
local buttonWidth,buttonHeight = getResponsiveSize(360), getResponsiveSize(60)

local strings = {
  ["loginBtn"] = "Bejelentkezés",
  ["registerBtn"] = "Regisztráció"
}

local function getResponsiveSize(size)
  return(screenX/1920) * size
end

local windowWidth,windowHeight = getResponsiveSize(400), getResponsiveSize(450)

function showLoginPanel()
    joinTick = getTickCount();
  addEventHandler("onClientRender", root, drawLoginPanel)
end

function drawLoginPanel()

  loginPanelX,loginPanelY = interpolateBetween(-windowWidth, screenY/2 -windowHeight/9, 5, screenX/1.600 -windowWidth, screenY/1.500 -windowHeight,0, (getTickCount()-joinTick)/1000, "OutBounce" );
 
  dxDrawRectangle(loginPanelX, loginPanelY, windowWidth,windowHeight, tocolor(0,0,0,190))
  drawButton(loginPanelX + windowWidth/2 - buttonWidth/2 + margin, loginPanelY + windowHeight - buttonHeight - margin, buttonWidth - margin*2, buttonHeight, strings.loginBtn, tocolor(0,0,0,150), tocolor(255,48,48,160), tocolor(255,255,255,255))
end

function drawButton(x,y,w,h,text,backgroundColor,hoverColor,textColor, font, textSize)
 
    if (isCursorInPosition(x,y,w,h)) then
      dxDrawRectangle(x,y,w,h,hoverColor)
    else
      dxDrawRectangle(x,y,w,h,textColor, font, textSize)  
   end

   centerText(text, x,y,w,h,textColor)

end

function isCursorInPosition(x,y,w,h)

  local cursorX,cursorY = getCursorPosition();
  cursorX,cursorY = cursorX * screenX, cursorY * screenY

 return(cursorX >= x and cursorX <= x + w) and (cursorX >= y and cursorY <= cursorY + h)
end    

function centerText(text,x,y,w,h,textColor,font,size)
  dxDrawText(text, x + w/2, y + h/2, x + w/2, y +  h/2, textColor,size,font, "center", "center", false,false,false,true)
end
showLoginPanel();

heres some pictures from debugscript 3: https://imgur.com/a/KgUtNv3

Edited by Patrick
Link to post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...