function cursor () showCursor(not isCursorShowing())endbindKey (\"m\", \"down\", cursor)addCommandHandler ( \"cursor\", cursor )local x,y = guiGetScreenSize()oX, oY = 1280, 768function hud () local time = getRealTime() local cursorX, cursorY = getCursorPosition() dxDrawText (time.hour .. \":\" .. time.minute, cursorX, cursorY, _, _, 0xcff00ff00, 2.1/oX*x, \"pricedown\", \"left\", \"top\")endaddEventHandler (\"onClientRender\", root, hud)
local screenW, screenH = guiGetScreenSize()local rectangleW, rectangleH = 300, 200local rectangleX, rectangleY = screenW/2 - rectangleW/2, screenH/2 - rectangleH/2local rectangleMovingOffsetX, rectangleMovingOffsetY = 0, 0local rectangleIsMoving = falseaddEventHandler(\"onClientRender\", root, function()dxDrawRectangle(rectangleX, rectangleY, rectangleW, rectangleH, tocolor(0, 0, 0, 150))end)addEventHandler(\"onClientKey\", root, function(button, state)if button == \"m\" and state then showCursor(not isCursorShowing())endend)addEventHandler(\"onClientClick\", root, function(button, state, cursorX, cursorY)if button == \"left\" and state == \"down\" then if isCursorInPosition(rectangleX, rectangleY, rectangleW, rectangleH) then rectangleIsMoving = true rectangleMovingOffsetX, rectangleMovingOffsetY = cursorX - rectangleX, cursorY - rectangleY endelse rectangleIsMoving = falseendend)addEventHandler(\"onClientCursorMove\", root, function(_, _, absoluteX, absoluteY)if rectangleIsMoving then rectangleX, rectangleY = absoluteX - rectangleMovingOffsetX, absoluteY - rectangleMovingOffsetYendend)function isCursorInPosition(rectX, rectY, rectW, rectH)local cursorX, cursorY = getCursorPosition()cursorX, cursorY = cursorX * screenW, cursorY * screenHreturn (cursorX >= rectX and cursorX <= rectX+rectW) and (cursorY >= rectY and cursorY <= rectY