SHARE
TWEET

Untitled

a guest Feb 18th, 2020 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sx, sy = guiGetScreenSize()
  2. relX, relY = sx/1440, sy/990
  3. pPos = {0.38, 0.35}
  4. panelString = ""
  5. dataPointer = false
  6. showPanel = false
  7. btnColor = tocolor(235, 129, 0, 230)
  8. moveOffset = {0, 0}
  9. isWindowMoved = false
  10. local teszt;
  11.  
  12. if showPanel then  
  13.     showCursor(true)
  14. end
  15.  
  16. if showPanel then
  17.     toggleAllControls(true)
  18. end
  19.  
  20. function draw()
  21.    
  22.     if showPanel then
  23.  
  24.         dxDrawRectangle(sx*pPos[1], sy*pPos[2], sx*0.23, sy*0.14, tocolor(0, 0, 0, 230)) -- alap
  25.         dxDrawRectangle(sx*pPos[1], sy*pPos[2], sx*0.23, sy*0.024, tocolor(130, 140, 150, 230)) -- fejléc
  26.          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 )
  27.  
  28.         dxDrawRectangle(sx*(pPos[1]+0.175), sy*(pPos[2]+0.002), sx*0.05, sy*0.02, btnColor)
  29.          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 )
  30.  
  31.         dxDrawRectangle(sx*(pPos[1]+0.0135), sy*(pPos[2]+0.1), sx*0.2, sy*0.03, tocolor(255, 255, 255, 255)) -- text mezo
  32.         local text;
  33.         if (string.len(panelString) >= 23) then
  34.             text = string.sub(panelString, string.len(panelString)-23, string.len(panelString))
  35.         else
  36.             text = panelString
  37.         end  
  38.  
  39.         if dataPointer then
  40.             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 )
  41.         else
  42.             if panelString == "" then
  43.                 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 )
  44.             else
  45.                 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 )
  46.             end
  47.         end
  48.  
  49.         if (isWindowMoved) then
  50.             local cX, cY = getCursorPosition();
  51.             pPos = {cX-moveOffset[1], cY-moveOffset[2]}
  52.         end
  53.  
  54.     end    
  55.  
  56. end
  57. addEventHandler("onClientRender", root, draw)
  58.  
  59. function panelOn ()
  60.     if not showPanel then
  61.         showPanel = true
  62.     end
  63. end
  64. addCommandHandler("bugreport", panelOn)
  65.  
  66.  
  67. function char (char)
  68.  
  69.     if showPanel then
  70.         if dataPointer then
  71.             panelString = panelString..char
  72.         end
  73.     end
  74.  
  75. end
  76. addEventHandler("onClientCharacter", root, char)
  77.  
  78. function click (btn, press)
  79.     if showPanel then
  80.         if btn == "left" then
  81.             if press == "down" then
  82.                 if not dataPointer then
  83.                     if isMouseInPosition(sx*(pPos[1]+0.0135), sy*(pPos[2]+0.1), sx*0.2, sy*0.03) then
  84.                         dataPointer = 1
  85.                     end
  86.                 else
  87.                     if not isMouseInPosition(sx*(pPos[1]+0.0135), sy*(pPos[2]+0.1), sx*0.2, sy*0.03) then
  88.                         dataPointer = false
  89.                     end
  90.                 end
  91.  
  92.                 if isMouseInPosition(sx*(pPos[1]+0.175), sy*(pPos[2]+0.002), sx*0.05, sy*0.02) then
  93.                     dataPointer = false
  94.                     panelString = ""
  95.                     showPanel = false
  96.                 end
  97.  
  98.                 if isMouseInPosition(sx*pPos[1], sy*pPos[2], sx*0.23, sy*0.14) then
  99.                     local cX, cY = getCursorPosition()
  100.                     moveOffset[1] = cX - pPos[1]
  101.                     moveOffset[2] = cY - pPos[2]
  102.                     isWindowMoved = true
  103.                 end
  104.             else
  105.                 isWindowMoved = false
  106.             end
  107.         end
  108.     end
  109. end
  110. addEventHandler("onClientClick", root, click)
  111.  
  112. function delete (key, pOr)
  113.     if showPanel then
  114.  
  115.         if (dataPointer) then
  116.             if (key == "backspace") then
  117.                 if (pOr) then
  118.                     panelString = string.sub(panelString, 0, string.len(panelString)-1)
  119.                     deletTimer = setTimer(function()
  120.                         panelString = string.sub(panelString, 0, string.len(panelString)-1)
  121.                     end, 100, 0)
  122.                 else
  123.                     if isTimer(deletTimer) then
  124.                         killTimer(deletTimer)
  125.                     end
  126.                 end
  127.             else
  128.                 if key == "enter" then
  129.                     if pOr then
  130.                         triggerServerEvent("outPut", root, panelString)
  131.                         dataPointer = false
  132.                         panelString = ""
  133.                     end
  134.                 end
  135.             end  
  136.         end
  137.  
  138.     end
  139. end
  140. addEventHandler("onClientKey", root, delete)
  141.  
  142. function cursorMove ()
  143.     if showPanel then
  144.         if isMouseInPosition(sx*(pPos[1]+0.175), sy*(pPos[2]+0.002), sx*0.05, sy*0.02) then
  145.             btnColor = tocolor(230, 48, 11, 230)
  146.         else
  147.             btnColor = tocolor(235, 129, 0, 230)
  148.         end
  149.     end
  150. end
  151. addEventHandler("onClientCursorMove", root, cursorMove)
  152.  
  153.  
  154. function isMouseInPosition ( x, y, width, height )
  155.     if ( not isCursorShowing( ) ) then
  156.         return false
  157.     end
  158.     local sx, sy = guiGetScreenSize ( )
  159.     local cx, cy = getCursorPosition ( )
  160.     local cx, cy = ( cx * sx ), ( cy * sy )
  161.    
  162.     return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
  163. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top