Advertisement
Guest User

Untitled

a guest
Sep 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.66 KB | None | 0 0
  1. local ui_get = ui.get
  2. local ui_set = ui.set
  3. local ui_set_visible = ui.set_visible
  4. local globals_tickcount = globals.tickcount
  5. local globals_tickinterval = globals.tickinterval
  6. local globals_realtime = globals.realtime
  7. local client_world_to_screen = client.world_to_screen
  8. local client_draw_text = client.draw_text
  9. local string_format = string.format
  10. local table_insert = table.insert
  11. local localplayer = entity.get_local_player;
  12.  
  13. local last_bullet_impact = {};
  14. local damage_indicator_displays = {}
  15.  
  16. local enabled_reference = ui.new_checkbox( "VISUALS", "Player ESP", "Damage Indicator" );
  17. local duration_reference = ui.new_slider( "VISUALS", "Player ESP", "Duration", 1, 10, 3, true, "s" );
  18. local mode_reference = ui.new_combobox( "VISUALS", "Player ESP", "Mode", { "Static", "Moving" } );
  19. local minimum_damage_referance = ui.reference( "RAGE", "Aimbot", "Minimum damage" );
  20.  
  21. local function min( a, b )
  22.  
  23.     if ( a < b ) then return a;
  24.     else return b; end
  25.  
  26. end
  27.  
  28. local function on_bullet_impact(e)
  29.  
  30.     if not ui_get( enabled_reference ) then return end
  31.  
  32.     if not ( client.userid_to_entindex( e.userid ) == localplayer() ) then return end
  33.  
  34.     last_bullet_impact[1] = e.x;
  35.     last_bullet_impact[2] = e.y;
  36.     last_bullet_impact[3] = e.z;
  37.  
  38. end
  39.  
  40. local function on_player_hurt(e)
  41.  
  42.     if not ui_get(enabled_reference) then return end
  43.     --local userid, attacker, health, armor, weapon, damage, dmg_armor, hitgroup = e.userid, e.attacker, e.health, e.armor, e.weapon, e.dmg_damage, e.dmg_armor, e.hitgroup
  44.     local userid, attacker, damage, health = e.userid, e.attacker, e.dmg_health, e.health
  45.  
  46.     if ( userid == nil ) or ( attacker == nil ) then return end
  47.  
  48.     local player = client.userid_to_entindex( userid );
  49.  
  50.     if not ( player == localplayer() ) then return end
  51.  
  52.     local x, y, z = last_bullet_impact[1], last_bullet_impact[2], last_bullet_impact[3];
  53.  
  54.     table_insert( damage_indicator_displays, { damage, globals_realtime( ), x, y, z, e  } );
  55.  
  56.     --table_insert(damage_indicator_displays, {damage, globals_realtime(), x, y, z + voZ, e})
  57. end
  58.  
  59. local function checkbox_callback()
  60.  
  61.     local enabled = ui_get( enabled_reference );
  62.  
  63.     ui_set_visible( duration_reference, enabled );
  64.     ui_set_visible( mode_reference, enabled );
  65.  
  66. end
  67.  
  68. checkbox_callback();
  69.  
  70. ui.set_callback( enabled_reference, checkbox_callback );
  71.  
  72. local function on_paint( ctx )
  73.  
  74.     if not ui_get( enabled_reference ) then return end
  75.    
  76.     local maximum_time = ui_get( duration_reference );
  77.     local minimum_damage = ui_get( minimum_damage_referance );
  78.  
  79.     local temporary_indicator_array = {};
  80.  
  81.     for i=1, #damage_indicator_displays do
  82.        
  83.         local indicator = damage_indicator_displays[ i ];
  84.  
  85.         local damage, elapsed_time, x, y, z, entity = indicator[ 1 ], globals_realtime( ) - indicator[ 2 ], indicator[ 3 ], indicator[ 4 ], indicator[ 5 ], indicator[ 6 ];
  86.         local damage_percent, elapsed_time_percent =  min( ( damage / minimum_damage ), 1 ), ( elapsed_time / maximum_time );
  87.  
  88.         if ( elapsed_time < maximum_time ) then
  89.  
  90.             local r, g, b, a = 255 - ( damage_percent * 255 ), 132 + ( damage_percent * 123 ), 133, elapsed_time_percent * 255;
  91.  
  92.             local z_addition = 0;
  93.             if ( ui_get( mode_reference ) == "Moving" ) then z_addition = ( elapsed_time_percent * 10 ); end
  94.  
  95.             local screen_x, screen_y = client_world_to_screen( ctx, x, y, z + z_addition );
  96.  
  97.             client_draw_text( ctx, screen_x, screen_y, r, g, b, a, "c", 0, damage )
  98.  
  99.             table_insert( temporary_indicator_array, indicator );
  100.  
  101.         end
  102.  
  103.     end
  104.  
  105.     damage_indicator_displays = temporary_indicator_array;
  106. end
  107.  
  108. client.set_event_callback("bullet_impact", on_bullet_impact);
  109. client.set_event_callback("player_hurt", on_player_hurt);
  110. client.set_event_callback("paint", on_paint);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement