Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.36 KB | None | 0 0
  1. script_name("Tablist")
  2. script_author("4el0ve4ik")
  3. script_version("v1.1")
  4. require "lib.moonloader"
  5. local tweaks = require "lib.mgtweaks"
  6. local bit = require "bit"
  7.  
  8. local qq = {}
  9.  
  10. function main()
  11. local color = 0xc8202020
  12. local font = renderCreateFont("Arial", 8, 1)
  13. local font1 = renderCreateFont("Arial", 11, 1)
  14. local wei = 580
  15. if not isSampLoaded() then return end
  16. local resX, resY = getScreenResolution()
  17. local resX, resY = resX / 2, resY / 2
  18. local gposX, gposY = convertWindowScreenCoordsToGameScreenCoords(resX+0.0, resY+0.0)
  19. local h = resY - 270
  20. local mh = tweaks.mouseHandler:new()
  21. local pposX, pposY = convertGameScreenCoordsToWindowScreenCoords(320.0, 224.0)
  22. local scrollBar = tweaks.scrollBar:new(resX+280, resY-340, 12, wei + 110, 1000, 25)
  23. while true do
  24. wait(0)
  25. sampToggleScoreboard(false)
  26. if isKeyJustPressed(9) and not isPauseMenuActive() then
  27. while true do
  28. wait(0)
  29. local flags1 = mh:isKeyPressed(VK_LBUTTON, resX-320, resY-360, wei + 15, 20)
  30. if flags1.isWnd == true then
  31. if flags1.isDownWnd == true then
  32. resX, resY = getCursorPos()
  33. scrollBar.x = resX + 480
  34. scrollBar.y = resY + 10
  35. resX = resX + 200
  36. resY = resY + 350
  37. end
  38. end
  39. delta = getMousewheelDelta()
  40. if delta < 0 then
  41. scrollBar.currLine = scrollBar.currLine - delta
  42. end
  43. if 0 < delta then
  44. scrollBar.currLine = scrollBar.currLine - delta
  45. end
  46. if isKeyJustPressed(38) then
  47. scrollBar.currLine= scrollBar.currLine - 15
  48. end
  49. if isKeyJustPressed(40) then
  50. scrollBar.currLine = scrollBar.currLine + 15
  51. end
  52. sampToggleScoreboard(false)
  53. local _, id = sampGetPlayerIdByCharHandle(playerPed)
  54. sampSetCursorMode(3)
  55. local colp = bit.bor(sampGetPlayerColor(id), 0xFF000000)
  56. players = sampGetMaxPlayerId(false)
  57. renderDrawBox(resX-320, resY-340, wei+20, 690, color)
  58. renderDrawBox(resX-320, resY-360, wei+32, 20, 0xc8161616)
  59. renderDrawBox(resX-310, resY-335, wei, 20, 0xc8666666)
  60. renderDrawBoxWithBorder(resX-310, resY-305, wei, 23, 0xc8161616, 3, 0xc800ffff)
  61. renderFontDrawText(font1, string.format("id"), resX-305, resY-332, 0xff00ffff)
  62. renderFontDrawText(font1, string.format("NickName"), resX-230, resY-332, 0xff00ffff)
  63. renderFontDrawText(font1, string.format("score"), resX-50, resY-332, 0xff00ffff)
  64. renderFontDrawText(font1, string.format("ping"), resX+230, resY-332, 0xff00ffff)
  65. renderFontDrawText(font1, string.format("%d", id), resX-305, resY-302, colp)
  66. renderFontDrawText(font1, string.format("%s", sampGetPlayerNickname(id)), resX-230, resY-302, colp)
  67. renderFontDrawText(font1, string.format("%s %s:%s", sampGetCurrentServerName(), sampGetCurrentServerAddress()), resX-310, resY-358, 0xffff0000)
  68. renderFontDrawText(font1, string.format("%d", sampGetPlayerScore(id)), resX-50, resY-302, colp)
  69. renderFontDrawText(font1, string.format("%d", sampGetPlayerPing(id)), resX+230, resY-302, colp)
  70. scrollBar.color = 0xc8292929
  71. for a = 0, 1001 do
  72. local _, idme = sampGetPlayerIdByCharHandle(playerPed)
  73. if sampIsPlayerConnected(a) and a ~= idme then
  74. qq[#qq+1] = a
  75. end
  76. end
  77. scrollBar.maxLines = #qq
  78. for k, v in pairs(qq) do
  79. if k > (scrollBar.currLine ) and k <= (scrollBar.currLine + scrollBar.visibleLines) then
  80. local col = bit.bor(sampGetPlayerColor(v), 0xFF000000)
  81. local flags = mh:isKeyPressed(VK_LBUTTON, resX-310 + 4, h, wei, 20)
  82. if flags.isWnd == true then
  83. if flags.isPressedWnd == true then
  84. resbox = true
  85. zap = v
  86. end
  87. if isKeyJustPressed(VK_RBUTTON) and not isKeyDown(VK_LBUTTON) then
  88. setClipboardText(string.format("%s",sampGetPlayerNickname(v)))
  89. end
  90. if isKeyDown(VK_LBUTTON) and isKeyJustPressed(VK_RBUTTON) then
  91. sampSendClickPlayer(v, 0)
  92. resubreak = true
  93. end
  94. end
  95. renderDrawBox(resX - 310, h, wei, 20, 0xc8161616)
  96. renderFontDrawText(font1, string.format("%d", v), resX-305, h+3, col)
  97. renderFontDrawText(font1, string.format("%s", sampGetPlayerNickname(v)), resX-230, h+3, col)
  98. renderFontDrawText(font1, string.format("%d", sampGetPlayerScore(v)), resX-50, h+3, col)
  99. renderFontDrawText(font1, string.format("%d", sampGetPlayerPing(v)), resX+230, h+3, col)
  100. if resbox and v == zap then
  101. renderDrawBoxWithBorder(resX-310, h, wei, 23, 0x00101010, 3, 0xc800ffff)
  102. end
  103. h = h + 25
  104. end
  105. end
  106. h= resY - 275
  107. scrollBar:draw()
  108. renderFontDrawText(font1, string.format("Online:%s", #qq+1), resX+220, resY-358, 0xffff0000)
  109. for d = 0,1001 do
  110. qq[#qq] = nil
  111. end
  112. if isKeyJustPressed(9) or isKeyJustPressed(27) or resubreak then
  113. sampToggleCursor(false)
  114. for a = 1, 1001 do
  115. qq[#qq] = nil
  116. end
  117. resubreak = false
  118. break
  119. end
  120. end
  121. end
  122. end
  123. end
  124.  
  125. function perm()
  126.  
  127. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement