SHARE
TWEET

Shadowtrack

a guest Dec 7th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --local variables for API. Automatically generated by https://github.com/simpleavaster/gslua/blob/master/authors/sapphyrus/generate_api.lua
  2. local client_latency, client_log, client_draw_rectangle, client_draw_circle_outline, client_userid_to_entindex, client_draw_indicator, client_draw_gradient, client_set_event_callback, client_screen_size, client_eye_position = client.latency, client.log, client.draw_rectangle, client.draw_circle_outline, client.userid_to_entindex, client.draw_indicator, client.draw_gradient, client.set_event_callback, client.screen_size, client.eye_position
  3. local client_draw_circle, client_color_log, client_delay_call, client_draw_text, client_visible, client_exec, client_trace_line, client_set_cvar = client.draw_circle, client.color_log, client.delay_call, client.draw_text, client.visible, client.exec, client.trace_line, client.set_cvar
  4. local client_world_to_screen, client_draw_hitboxes, client_get_cvar, client_draw_line, client_camera_angles, client_draw_debug_text, client_random_int, client_random_float = client.world_to_screen, client.draw_hitboxes, client.get_cvar, client.draw_line, client.camera_angles, client.draw_debug_text, client.random_int, client.random_float
  5. local entity_get_local_player, entity_is_enemy, entity_hitbox_position, entity_get_player_name, entity_get_steam64, entity_get_bounding_box, entity_get_all, entity_set_prop = entity.get_local_player, entity.is_enemy, entity.hitbox_position, entity.get_player_name, entity.get_steam64, entity.get_bounding_box, entity.get_all, entity.set_prop
  6. local entity_is_alive, entity_get_player_weapon, entity_get_prop, entity_get_players, entity_get_classname = entity.is_alive, entity.get_player_weapon, entity.get_prop, entity.get_players, entity.get_classname
  7. local globals_realtime, globals_absoluteframetime, globals_tickcount, globals_curtime, globals_mapname, globals_tickinterval, globals_framecount, globals_frametime, globals_maxplayers = globals.realtime, globals.absoluteframetime, globals.tickcount, globals.curtime, globals.mapname, globals.tickinterval, globals.framecount, globals.frametime, globals.maxplayers
  8. local ui_new_slider, ui_new_combobox, ui_reference, ui_set_visible, ui_is_menu_open, ui_new_color_picker, ui_set_callback, ui_set, ui_new_checkbox, ui_new_hotkey, ui_new_button, ui_new_multiselect, ui_get = ui.new_slider, ui.new_combobox, ui.reference, ui.set_visible, ui.is_menu_open, ui.new_color_picker, ui.set_callback, ui.set, ui.new_checkbox, ui.new_hotkey, ui.new_button, ui.new_multiselect, ui.get
  9. local math_ceil, math_tan, math_log10, math_randomseed, math_cos, math_sinh, math_random, math_huge, math_pi, math_max, math_atan2, math_ldexp, math_floor, math_sqrt, math_deg, math_atan, math_fmod = math.ceil, math.tan, math.log10, math.randomseed, math.cos, math.sinh, math.random, math.huge, math.pi, math.max, math.atan2, math.ldexp, math.floor, math.sqrt, math.deg, math.atan, math.fmod
  10. local math_acos, math_pow, math_abs, math_min, math_sin, math_frexp, math_log, math_tanh, math_exp, math_modf, math_cosh, math_asin, math_rad = math.acos, math.pow, math.abs, math.min, math.sin, math.frexp, math.log, math.tanh, math.exp, math.modf, math.cosh, math.asin, math.rad
  11. local table_maxn, table_foreach, table_sort, table_remove, table_foreachi, table_move, table_getn, table_concat, table_insert = table.maxn, table.foreach, table.sort, table.remove, table.foreachi, table.move, table.getn, table.concat, table.insert
  12. local string_find, string_format, string_rep, string_gsub, string_len, string_gmatch, string_dump, string_match, string_reverse, string_byte, string_char, string_upper, string_lower, string_sub = string.find, string.format, string.rep, string.gsub, string.len, string.gmatch, string.dump, string.match, string.reverse, string.byte, string.char, string.upper, string.lower, string.sub
  13. --end of local variables
  14.  
  15. --hitbox indexes by sapphyrus
  16. --[[
  17.     hitbox_head = 0,
  18.     hitbox_neck = 1,
  19.     hitbox_pelvis = 2,
  20.     hitbox_spine_0 = 3,
  21.     hitbox_spine_1 = 4,
  22.     hitbox_spine_2 = 5,
  23.     hitbox_spine_3 = 6,
  24.     hitbox_leg_upper_L = 7,
  25.     hitbox_leg_upper_R = 8,
  26.     hitbox_leg_lower_L = 9,
  27.     hitbox_leg_lower_R = 10,
  28.     hitbox_ankle_L = 11,
  29.     hitbox_ankle_R = 12,
  30.     hitbox_hand_L = 13,
  31.     hitbox_hand_R = 14,
  32.     hitbox_arm_upper_L = 15,
  33.     hitbox_arm_lower_L = 16,
  34.     hitbox_arm_upper_R = 17,
  35.     hitbox_arm_lower_R = 18,
  36. ]]--
  37.  
  38. local ui_mode = ui_new_combobox('visuals', 'player esp', 'Visualize Backtrack', 'Off', 'Line', 'Cross', 'Dot', 'Skeleton')
  39. local ui_color = ui_new_color_picker('visuals', 'player esp', 'Visualize Backtrack Color', 214, 0, 255, 255)
  40.  
  41. local level_0_table = {}
  42.  
  43. local bool_line = false
  44. local bool_cross = false
  45. local bool_dot = false
  46. local bool_skeleton = false
  47. local color_r = 0
  48. local color_g = 0
  49. local color_b = 0
  50. local color_a = 0
  51.  
  52. local function menu_call()
  53.     local mode = ui_get(ui_mode)
  54.  
  55.     bool_line = mode == 'Line'
  56.     bool_cross =  mode == 'Cross'
  57.     bool_dot = mode == 'Dot'
  58.     bool_skeleton = mode == 'Skeleton'
  59.  
  60.     if mode ~= 'Off' then
  61.         color_r, color_g, color_b, color_a = ui_get(ui_color)
  62.     end
  63. end
  64.  
  65. menu_call()
  66. ui_set_callback(ui_mode, menu_call)
  67. ui_set_callback(ui_color, menu_call)
  68.  
  69. local function on_run_command(e) --fakelag ticks
  70.     --inserting information
  71.     local enemy_players = entity_get_players(true)
  72.     local time = globals_realtime()
  73.     if #enemy_players ~= 0 then
  74.         time = globals_realtime()
  75.         for i = 1, #enemy_players do
  76.             local enemy = enemy_players[i]
  77.             local level_1_table = {}
  78.             if level_0_table[enemy] ~= nil then
  79.                 level_1_table = level_0_table[enemy]
  80.             end
  81.             level_2_table = {time}
  82.             for j  = 0, 18 do
  83.                 local hitbox_x, hitbox_y, hitbox_z = entity_hitbox_position(enemy, j)
  84.                 table_insert(level_2_table, {hitbox_x, hitbox_y, hitbox_z})
  85.             end
  86.             table_insert(level_1_table, level_2_table)
  87.             level_0_table[enemy] = level_1_table
  88.         end
  89.     end
  90.     --removing old information
  91.     for i = 1, #level_0_table do
  92.         if level_0_table[i] ~= nil then
  93.             for j = 1, #level_0_table[i] do
  94.                 if level_0_table[i][j] ~= nil then
  95.                     if level_0_table[i][j][1] < globals_realtime() - (0.2 --[[+ client_latency]]) then --i used the time value and not the tickvalue to support every server, that's  kinda unacurate though
  96.                         table_remove(level_0_table[i], j)
  97.                     end
  98.                 end
  99.             end
  100.         end
  101.     end
  102. end
  103.  
  104. local function on_paint(ctx)
  105.     if bool_line then
  106.         for i = 1, #level_0_table do
  107.             if level_0_table[i] ~= nil then
  108.                 local last_x, last_y = nil, nil
  109.                 for j = 1, #level_0_table[i] do
  110.                     if level_0_table[i][j] ~= nil then
  111.                         local scr_x, scr_y = client_world_to_screen(ctx, level_0_table[i][j][2][1], level_0_table[i][j][2][2], level_0_table[i][j][2][3])
  112.                         if (scr_x ~= nil) and scr_y ~= nil then
  113.                             if (last_x ~= nil) and (last_y ~= nil) then
  114.                                 client_draw_line(ctx, last_x, last_y, scr_x, scr_y, color_r, color_g, color_b, color_a)
  115.                             end
  116.                             last_x, last_y = scr_x, scr_y
  117.                         end
  118.                     end
  119.                 end
  120.             end
  121.         end
  122.     elseif bool_cross then
  123.         for i = 1, #level_0_table do
  124.             if level_0_table[i] ~= nil then
  125.                 for j = 1, #level_0_table[i] do
  126.                     if level_0_table[i][j] ~= nil then
  127.                         local scr_x, scr_y = client_world_to_screen(ctx, level_0_table[i][j][2][1], level_0_table[i][j][2][2], level_0_table[i][j][2][3])
  128.                         if (scr_x ~= nil) and scr_y ~= nil then
  129.                             client_draw_line(ctx, scr_x + 3, scr_y + 3, scr_x - 3, scr_y - 3, color_r, color_g, color_b, color_a)
  130.                             client_draw_line(ctx, scr_x - 3, scr_y + 3, scr_x + 3, scr_y - 3, color_r, color_g, color_b, color_a)
  131.                         end
  132.                     end
  133.                 end
  134.             end
  135.         end
  136.     elseif bool_dot then
  137.         for i = 1, #level_0_table do
  138.             if level_0_table[i] ~= nil then
  139.                 for j = 1, #level_0_table[i] do
  140.                     if level_0_table[i][j] ~= nil then
  141.                         local scr_x, scr_y = client_world_to_screen(ctx, level_0_table[i][j][2][1], level_0_table[i][j][2][2], level_0_table[i][j][2][3])
  142.                         if (scr_x ~= nil) and scr_y ~= nil then
  143.                             client_draw_circle(ctx, scr_x, scr_y, color_r, color_g, color_b, color_a, 7, 0, 1)
  144.                         end
  145.                     end
  146.                 end
  147.             end
  148.         end
  149.     elseif  bool_skeleton then
  150.         for i = 1, #level_0_table do
  151.             if level_0_table[i] ~= nil then
  152.                 local last_x, last_y = nil, nil
  153.                 for j = 1, #level_0_table[i] do
  154.                     if level_0_table[i][j] ~= nil then
  155.                         --k starts as 2 to skip the time thing 
  156.                         for k = 2, #level_0_table[i][j] do
  157.                             local scr_x, scr_y = client_world_to_screen(ctx, level_0_table[i][j][k][1], level_0_table[i][j][k][2], level_0_table[i][j][k][3])
  158.                             if (scr_x ~= nil) and scr_y ~= nil then
  159.                                 if (last_x ~= nil) and (last_y ~= nil) then
  160.                                     client_draw_line(ctx, last_x, last_y, scr_x, scr_y, color_r, color_g, color_b, color_a)
  161.                                 end
  162.                                 last_x, last_y = scr_x, scr_y
  163.                             end
  164.                         end
  165.                     end
  166.                 end
  167.             end
  168.         end
  169.     end
  170. end
  171.  
  172. client_set_event_callback("run_command", on_run_command)
  173. client_set_event_callback('paint', on_paint)
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top