Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/07/25 in all areas

  1. good job, if you have a different problem please post it here or create a new topic and tag m
    1 point
  2. There are two kinds of methods, one with setTimer and the other with the alternative onClientRender setTimer : The cursor always appears in the center for one frame after showCursor(true). function openPanel() showCursor(true) -- Save the last cursor position (values between 0 and 1) local x, y = getCursorPosition() -- Get the screen resolution local sx, sy = guiGetScreenSize() -- After 50ms, set the cursor back to its previous position setTimer(function() setCursorPosition(x * sx, y * sy) end, 50, 1) end onClientRender: Use a timer or onClientRender to set the position after showing the cursor. function panelAc() showCursor(true) local x, y = getCursorPosition() local sx, sy = guiGetScreenSize() local function imlecDuzelt() setCursorPosition(x * sx, y * sy) removeEventHandler("onClientRender", root, imlecDuzelt) end addEventHandler("onClientRender", root, imlecDuzelt) end your fixed code : local toggle = false local savedCursorX, savedCursorY local function togglePanel() toggle = not toggle if toggle then showCursor(true) if savedCursorX and savedCursorY then local screenX, screenY = guiGetScreenSize() -- Wait one frame before setting the cursor position setTimer(function() setCursorPosition(savedCursorX * screenX, savedCursorY * screenY) end, 50, 1) end else savedCursorX, savedCursorY = getCursorPosition() showCursor(false) end end bindKey("k", "down", togglePanel) I think you understand, if you have a different problem please post it here or create a new topic and tag me
    1 point
  3. I've run out of suggestions unfortunately, if i have smth i will come back
    1 point
  4. Is there any error on debug or F8? I dont understand why its not working
    1 point
  5. local toggle = false local savedCursorX, savedCursorY local function restoreCursorPos() if savedCursorX and savedCursorY then local screenX, screenY = guiGetScreenSize() setCursorPosition(savedCursorX * screenX, savedCursorY * screenY) end end local function togglePanel() toggle = not toggle if toggle then showCursor(true) for i = 1, 5 do setTimer(restoreCursorPos, i * 50, 1) end else savedCursorX, savedCursorY = getCursorPosition() showCursor(false) end end bindKey("k", "down", togglePanel) Can you just try this? ı added a timer for it.
    1 point
  6. cursorX, cursorY = getCursorPosition() -- showCursor(false) <-- Use Before Then ... -- showCursor(true) <-- Use After Then screenX, screenY = guiGetScreenSize() setCursorPosition(cursorX*screenX, cursorY*screenY)
    1 point
×
×
  • Create New...