Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ui_get, ui_set, ui_ref, ui_set_visible = ui.get, ui.set, ui.reference, ui.set_visible
- local ind = ui.new_multiselect("AA", "Fake lag", "Fake lag indicator", "Log in console", "Print indicator")
- local choked_cmds = 0
- local function cmd(e)
- choked_cmds = e.chokedcommands
- end
- client.set_event_callback("setup_command", cmd)
- local function contains(table, val)
- for i=1, #table do
- if table[i] == val then
- return true
- end
- end
- return false
- end
- local function g_math(int, max, declspec)
- local int = (int > max and max or int)
- local tmp = max / int;
- local i = (declspec / tmp)
- i = (i >= 0 and math.floor(i + 0.5) or math.ceil(i - 0.5))
- return i
- end
- local function interpolate_c(number, max)
- local colors = {
- { 124, 195, 13 },
- { 176, 205, 10 },
- { 213, 201, 19 },
- { 220, 169, 16 },
- { 228, 126, 10 },
- { 229, 104, 8 },
- { 235, 63, 6 },
- { 237, 27, 3 },
- { 255, 0, 0 }
- }
- i = g_math(number, max, #colors)
- return
- colors[i <= 1 and 1 or i][1],
- colors[i <= 1 and 1 or i][2],
- colors[i <= 1 and 1 or i][3]
- end
- client.set_event_callback("paint", function()
- if entity.get_local_player() == nil or entity.get_prop(entity.get_local_player(), "m_lifeState") ~= 0 then return end
- local bFreezeTime = entity.get_prop(entity.get_game_rules(), "m_bFreezePeriod")
- if (bFreezeTime) == 1 then return end
- local value = ui_get(ind)
- if contains(value, "Log in console") then
- if choked_cmds > 3 then
- client.log("Fake lag: ", choked_cmds)
- end
- end
- if contains(value, "Print indicator") then
- local outline = outline == nil and true or outline
- local radius = 9
- local start_degrees = 0
- local r, g, b = interpolate_c(choked_cmds, 14)
- local percent = choked_cmds / 14
- if choked_cmds >= 0 and choked_cmds <= 14 then
- local fl1 = renderer.indicator(r, g, b, 255, "FL")
- if outline then
- renderer.circle_outline(54, fl1 + 15, 0, 0, 0, 200, radius, start_degrees, 1.0, 5)
- end
- renderer.circle_outline(54, fl1 + 15, r, g, b, 255, radius - 1, start_degrees, percent, 3)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement