Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. local console_log = client.log
  2. local console_cmd = client.exec
  3. local get_local_player = entity.get_local_player
  4. local get_player_name = entity.get_player_name
  5. local get_prop = entity.get_prop
  6. local set_prop = entity.set_prop
  7. local get_all_ents = entity.get_all
  8. local get_all_players = entity.get_players
  9. local userid_to_entindex = client.userid_to_entindex
  10. local get_cvar = client.get_cvar
  11. local draw_debug_text = client.draw_debug_text
  12. local draw_hitboxes = client.draw_hitboxes
  13. local draw_text = client.draw_text
  14. local random_int = client.random_int
  15. local random_float = client.random_float
  16. local get_var = ui.get_var
  17. local ui_set = ui.set
  18. local ui_get = ui.get
  19. local get_curtime = globals.curtime
  20.  
  21. local damage_indicator = ui.new_checkbox("VISUALS", "Other ESP", "Show damage dealt")
  22. if not damage_indicator then
  23. console_log("new_checkbox failed, exiting script")
  24. return
  25. end
  26.  
  27. --local curve_damage_indicator = ui.new_checkbox("VISUALS", "Other ESP", "Damage-Text Curve")
  28.  
  29. local red = ui.new_slider("VISUALS", "Other ESP", "Damage-Text Red", 0, 255)
  30. local green = ui.new_slider("VISUALS", "Other ESP", "Damage-Text Green", 0, 255)
  31. local blue = ui.new_slider("VISUALS", "Other ESP", "Damage-Text Blue", 0, 255)
  32.  
  33. ui_set(red, 255)
  34. ui_set(green, 255)
  35. ui_set(blue, 255)
  36.  
  37. local damage_queue = {}
  38. for i = 1,60,1 do
  39. damage_queue[i] = { 0 , 0 , 0 , 0, 0 }
  40. end
  41.  
  42. local function get_eye_pos(ent)
  43. local ox,oy,oz = get_prop(ent, "m_vecOrigin")
  44. oz = oz - 72
  45. return ox, oy, oz
  46. end
  47.  
  48. local function on_player_hurt(e)
  49.  
  50. local attacker_uid = e.attacker
  51. local attacker_entid = userid_to_entindex(attacker_uid)
  52. local victim_uid = e.userid
  53. local victim_entid = userid_to_entindex(victim_uid)
  54. local damage_taken = e.dmg_health
  55.  
  56. if attacker_entid == get_local_player() then
  57.  
  58. local curtime = globals.curtime()
  59. local x,y,z = get_eye_pos(victim_entid)
  60. if not x then
  61. return
  62. end
  63.  
  64. for i = 60,2,-1 do
  65.  
  66. damage_queue[i] = damage_queue[i-1]
  67.  
  68. end
  69.  
  70. damage_queue[1] = {x, y, z, damage_taken, curtime}
  71. end
  72.  
  73. end
  74.  
  75. local function on_paint(context)
  76.  
  77. if not ui_get(damage_indicator) then
  78. return
  79. end
  80.  
  81. for i = 1,60,1 do
  82.  
  83. --if damage_queue[i][5] ~= nil then
  84.  
  85. if damage_queue[i][5] + 7 >= globals.curtime() then
  86.  
  87. if damage_queue[i][1] ~= nil then
  88.  
  89. local x, y = client.world_to_screen(context, damage_queue[i][1], damage_queue[i][2], damage_queue[i][3])
  90. if x ~= nil and y ~= nil then
  91. local dmg = damage_queue[i][4]
  92. local r = ui_get(red)
  93. local g = ui_get(green)
  94. local b = ui_get(blue)
  95. local offset = 100 * (7 / (damage_queue[i][5] + 7 - globals.curtime()))
  96. draw_text(context, x, y - offset, r, g, b, 255, "c", 0, dmg)
  97. end
  98.  
  99. end
  100.  
  101. end
  102.  
  103. --end
  104.  
  105. end
  106.  
  107. end
  108.  
  109.  
  110. local err =
  111. client.set_event_callback('player_hurt', on_player_hurt) or
  112. client.set_event_callback('paint', on_paint)
  113.  
  114. if err then
  115. console_log('set_event_callback failed: ', err)
  116. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement