Advertisement
NmChris

Draw fake skeleton

Jan 18th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.75 KB | None | 0 0
  1. local client_set_event_callback = client.set_event_callback
  2. local entity_get_local_player, entity_hitbox_position, entity_is_alive = entity.get_local_player, entity.hitbox_position, entity.is_alive
  3. local renderer_line, renderer_world_to_screen = renderer.line, renderer.world_to_screen
  4. local ui_get, ui_new_checkbox, ui_new_color_picker, ui_reference, ui_set_callback, ui_set_visible = ui.get, ui.new_checkbox, ui.new_color_picker, ui.reference, ui.set_callback, ui.set_visible
  5.  
  6. -- Menu
  7. local menu = {
  8.  
  9.     draw_fake = ui_new_checkbox("AA", "Other", "Draw fake angles"),
  10.     draw_fake_color = ui_new_color_picker("AA", "Other", "Fake color", 255, 255, 255, 255),
  11.  
  12. }
  13.  
  14. -- References
  15. local thirdperson, thirdperson_hotkey = ui_reference("VISUALS", "Effects", "Force third person (alive)")
  16.  
  17. -- Variables
  18. local hitboxPos = {}
  19.  
  20. local hitbox = {
  21.  
  22.     [0] = "head_0",
  23.     [1] = "neck_0",
  24.     [2] = "pelvis",
  25.     [3] = "spine_0",
  26.     [4] = "spine_1",
  27.     [5] = "spine_2",
  28.     [6] = "spine_3",
  29.     [7] = "leg_upper_L",
  30.     [8] = "leg_upper_R",
  31.     [9] = "leg_lower_L",
  32.     [10] = "leg_lower_R",
  33.     [11] = "ankle_L",
  34.     [12] = "ankle_R",
  35.     [13] = "hand_L",
  36.     [14] = "hand_R",
  37.     [15] = "arm_upper_L",
  38.     [16] = "arm_lower_L",
  39.     [17] = "arm_upper_R",
  40.     [18] = "arm_lower_R",
  41.  
  42. }
  43.  
  44. local drawPair = {
  45.  
  46.     [11] = {9}, -- L angkle to lower
  47.     [12] = {10}, -- R ankle to lower
  48.     [9] = {7}, -- L lower to upper
  49.     [10] = {8}, -- R lower to upper
  50.     [7] = {2}, -- L upper to pelvis
  51.     [8] = {2}, -- R upper to pelvis
  52.     [2] = {3}, -- Pelvis to spine 0
  53.     [3] = {4}, -- Spine 0 to spine 1
  54.     [4] = {5}, -- Spine 1 to spine 2
  55.     [5] = {6}, -- Spine 2 to spine 3
  56.     [6] = {1, 15, 17}, -- Spine 3 to neck and upper arms
  57.     [1] = {0}, -- Neck to head
  58.     [15] = {16}, -- L arm upper to L arm lower
  59.     [17] = {18}, -- R arm upper to R arm lower
  60.     [16] = {13}, -- L arm lower to L hand
  61.     [18] = {14}, -- R arm lower to R hand
  62.  
  63. }
  64.  
  65. -- Game events
  66. client_set_event_callback("run_command", function(cmd)
  67.  
  68.     if not ui_get(menu.draw_fake) then
  69.  
  70.         return
  71.        
  72.     end
  73.  
  74.     if cmd.chokedcommands == 1 then
  75.  
  76.         for i = 0, 18 do
  77.  
  78.             hitboxPos[i] = {entity_hitbox_position(entity_get_local_player(), i)}
  79.  
  80.         end
  81.  
  82.     end
  83.  
  84. end)
  85.  
  86. local debug_cb = ui_new_checkbox("AA", "Other", "Debug")
  87.  
  88. client_set_event_callback("paint", function()
  89.  
  90.     if not ui_get(menu.draw_fake) then
  91.  
  92.         return
  93.        
  94.     end
  95.  
  96.     if not ui_get(thirdperson) or not ui_get(thirdperson_hotkey) then
  97.  
  98.         return
  99.  
  100.     end
  101.  
  102.     if not entity_is_alive(entity_get_local_player()) or #hitboxPos == 0 then
  103.  
  104.         return
  105.  
  106.     end
  107.  
  108.     local r, g, b, a = ui_get(menu.draw_fake_color)
  109.  
  110.     for k, v in pairs(drawPair) do
  111.  
  112.         local x1, y1 = renderer_world_to_screen(hitboxPos[k][1], hitboxPos[k][2], hitboxPos[k][3])
  113.  
  114.         for i = 1, #v do
  115.  
  116.             local x2, y2 = renderer_world_to_screen(hitboxPos[v[i]][1], hitboxPos[v[i]][2], hitboxPos[v[i]][3])
  117.  
  118.             if x1 ~= nil and y1 ~= nil and x2 ~= nil and y2 ~= nil then
  119.  
  120.                 renderer_line(x1 + 1, y1 + 1, x2 + 1, y2 + 1, r, g, b, a)
  121.                 renderer_line(x1, y1 + 1, x2, y2 + 1, r, g, b, a)
  122.                 renderer_line(x1 - 1, y1 + 1, x2 - 1, y2 + 1, r, g, b, a)
  123.  
  124.                 renderer_line(x1 + 1, y1, x2 + 1, y2, r, g, b, a)
  125.                 renderer_line(x1, y1, x2, y2, r, g, b, a)
  126.                 renderer_line(x1 - 1, y1, x2 - 1, y2, r, g, b, a)
  127.  
  128.                 renderer_line(x1 + 1, y1 - 1, x2 + 1, y2 - 1, r, g, b, a)
  129.                 renderer_line(x1, y1 - 1, x2, y2 - 1, r, g, b, a)
  130.                 renderer_line(x1 - 1, y1 - 1, x2 - 1, y2 - 1, r, g, b, a)
  131.  
  132.             end
  133.  
  134.         end
  135.        
  136.     end
  137.  
  138. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement