Advertisement
Guest User

Untitled

a guest
May 24th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. local ui_get, ui_set, ui_ref, ui_set_visible = ui.get, ui.set, ui.reference, ui.set_visible
  2. local ind = ui.new_multiselect("AA", "Fake lag", "Fake lag indicator", "Log in console", "Print indicator")
  3. local choked_cmds = 0
  4.  
  5. local function cmd(e)
  6. choked_cmds = e.chokedcommands
  7. end
  8. client.set_event_callback("setup_command", cmd)
  9.  
  10. local function contains(table, val)
  11. for i=1, #table do
  12. if table[i] == val then
  13. return true
  14. end
  15. end
  16. return false
  17. end
  18.  
  19. local function g_math(int, max, declspec)
  20. local int = (int > max and max or int)
  21.  
  22. local tmp = max / int;
  23. local i = (declspec / tmp)
  24. i = (i >= 0 and math.floor(i + 0.5) or math.ceil(i - 0.5))
  25.  
  26. return i
  27. end
  28.  
  29. local function interpolate_c(number, max)
  30. local colors = {
  31. { 124, 195, 13 },
  32. { 176, 205, 10 },
  33. { 213, 201, 19 },
  34. { 220, 169, 16 },
  35. { 228, 126, 10 },
  36. { 229, 104, 8 },
  37. { 235, 63, 6 },
  38. { 237, 27, 3 },
  39. { 255, 0, 0 }
  40. }
  41.  
  42. i = g_math(number, max, #colors)
  43. return
  44. colors[i <= 1 and 1 or i][1],
  45. colors[i <= 1 and 1 or i][2],
  46. colors[i <= 1 and 1 or i][3]
  47. end
  48.  
  49.  
  50. client.set_event_callback("paint", function()
  51. if entity.get_local_player() == nil or entity.get_prop(entity.get_local_player(), "m_lifeState") ~= 0 then return end
  52.  
  53. local bFreezeTime = entity.get_prop(entity.get_game_rules(), "m_bFreezePeriod")
  54. if (bFreezeTime) == 1 then return end
  55.  
  56. local value = ui_get(ind)
  57.  
  58. if contains(value, "Log in console") then
  59. if choked_cmds > 3 then
  60. client.log("Fake lag: ", choked_cmds)
  61. end
  62. end
  63.  
  64. if contains(value, "Print indicator") then
  65. local outline = outline == nil and true or outline
  66. local radius = 9
  67. local start_degrees = 0
  68. local r, g, b = interpolate_c(choked_cmds, 14)
  69. local percent = choked_cmds / 14
  70. if choked_cmds >= 0 and choked_cmds <= 14 then
  71. local fl1 = renderer.indicator(r, g, b, 255, "FL")
  72. if outline then
  73. renderer.circle_outline(54, fl1 + 15, 0, 0, 0, 200, radius, start_degrees, 1.0, 5)
  74. end
  75. renderer.circle_outline(54, fl1 + 15, r, g, b, 255, radius - 1, start_degrees, percent, 3)
  76. end
  77. end
  78. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement