Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sx, sy = guiGetScreenSize()
- relX, relY = sx/1440, sy/990
- pPos = {0.38, 0.35}
- panelString = ""
- dataPointer = false
- showPanel = false
- btnColor = tocolor(235, 129, 0, 230)
- moveOffset = {0, 0}
- isWindowMoved = false
- local teszt;
- if showPanel then
- showCursor(true)
- end
- if showPanel then
- toggleAllControls(true)
- end
- function draw()
- if showPanel then
- dxDrawRectangle(sx*pPos[1], sy*pPos[2], sx*0.23, sy*0.14, tocolor(0, 0, 0, 230)) -- alap
- dxDrawRectangle(sx*pPos[1], sy*pPos[2], sx*0.23, sy*0.024, tocolor(130, 140, 150, 230)) -- fejléc
- dxDrawText("Bug Report", sx*(pPos[1]+0.1155), sy*(pPos[2]+0.013), _, _, tocolor(255, 255, 255, 255), relX*1.5, relY*1.6, "default-bold", "center", "center", false, false, false )
- dxDrawRectangle(sx*(pPos[1]+0.175), sy*(pPos[2]+0.002), sx*0.05, sy*0.02, btnColor)
- dxDrawText("Kilép", sx*(pPos[1]+0.2), sy*(pPos[2]+0.0115), _, _, tocolor(255, 255, 255, 255), relX*1.5, relY*1.6, "default-bold", "center", "center", false, false, false )
- dxDrawRectangle(sx*(pPos[1]+0.0135), sy*(pPos[2]+0.1), sx*0.2, sy*0.03, tocolor(255, 255, 255, 255)) -- text mezo
- local text;
- if (string.len(panelString) >= 23) then
- text = string.sub(panelString, string.len(panelString)-23, string.len(panelString))
- else
- text = panelString
- end
- if dataPointer then
- dxDrawText(text.."|", sx*(pPos[1]+0.113), sy*(pPos[2]+0.1128), _, _, tocolor(0, 0, 0, 255), relX*1.5, relY*1.6, "default-bold", "center", "center", false, false, false )
- else
- if panelString == "" then
- dxDrawText("Bug Report", sx*(pPos[1]+0.11), sy*(pPos[2]+0.1128), _, _, tocolor(0, 0, 0, 255), relX*1.5, relY*1.6, "default-bold", "center", "center", false, false, false )
- else
- dxDrawText(text, sx*(pPos[1]+0.11), sy*(pPos[2]+0.1128), _, _, tocolor(0, 0, 0, 255), relX*1.5, relY*1.6, "default-bold", "center", "center", false, false, false )
- end
- end
- if (isWindowMoved) then
- local cX, cY = getCursorPosition();
- pPos = {cX-moveOffset[1], cY-moveOffset[2]}
- end
- end
- end
- addEventHandler("onClientRender", root, draw)
- function panelOn ()
- if not showPanel then
- showPanel = true
- end
- end
- addCommandHandler("bugreport", panelOn)
- function char (char)
- if showPanel then
- if dataPointer then
- panelString = panelString..char
- end
- end
- end
- addEventHandler("onClientCharacter", root, char)
- function click (btn, press)
- if showPanel then
- if btn == "left" then
- if press == "down" then
- if not dataPointer then
- if isMouseInPosition(sx*(pPos[1]+0.0135), sy*(pPos[2]+0.1), sx*0.2, sy*0.03) then
- dataPointer = 1
- end
- else
- if not isMouseInPosition(sx*(pPos[1]+0.0135), sy*(pPos[2]+0.1), sx*0.2, sy*0.03) then
- dataPointer = false
- end
- end
- if isMouseInPosition(sx*(pPos[1]+0.175), sy*(pPos[2]+0.002), sx*0.05, sy*0.02) then
- dataPointer = false
- panelString = ""
- showPanel = false
- end
- if isMouseInPosition(sx*pPos[1], sy*pPos[2], sx*0.23, sy*0.14) then
- local cX, cY = getCursorPosition()
- moveOffset[1] = cX - pPos[1]
- moveOffset[2] = cY - pPos[2]
- isWindowMoved = true
- end
- else
- isWindowMoved = false
- end
- end
- end
- end
- addEventHandler("onClientClick", root, click)
- function delete (key, pOr)
- if showPanel then
- if (dataPointer) then
- if (key == "backspace") then
- if (pOr) then
- panelString = string.sub(panelString, 0, string.len(panelString)-1)
- deletTimer = setTimer(function()
- panelString = string.sub(panelString, 0, string.len(panelString)-1)
- end, 100, 0)
- else
- if isTimer(deletTimer) then
- killTimer(deletTimer)
- end
- end
- else
- if key == "enter" then
- if pOr then
- triggerServerEvent("outPut", root, panelString)
- dataPointer = false
- panelString = ""
- end
- end
- end
- end
- end
- end
- addEventHandler("onClientKey", root, delete)
- function cursorMove ()
- if showPanel then
- if isMouseInPosition(sx*(pPos[1]+0.175), sy*(pPos[2]+0.002), sx*0.05, sy*0.02) then
- btnColor = tocolor(230, 48, 11, 230)
- else
- btnColor = tocolor(235, 129, 0, 230)
- end
- end
- end
- addEventHandler("onClientCursorMove", root, cursorMove)
- function isMouseInPosition ( x, y, width, height )
- if ( not isCursorShowing( ) ) then
- return false
- end
- local sx, sy = guiGetScreenSize ( )
- local cx, cy = getCursorPosition ( )
- local cx, cy = ( cx * sx ), ( cy * sy )
- return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement