Advertisement
Guest User

elleqt_hitlist

a guest
Dec 11th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // pasted by elleqt
  2. var logs = [];
  3. var alphaH = 200;
  4. var alphaB = 95;
  5. var position = {
  6.   x: 100,
  7.   y: 100
  8. }
  9. var rgbline = 30;
  10. var damagee = 0;
  11. var olddamage = 0;
  12. var itteration = 0;
  13. var damageColors = {
  14.   lethal: [0, 255, 0, 255],
  15.   semi:   [150, 255, 0, 255],
  16.   half:   [220, 255, 0, 255],
  17.   low:    [255, 255, 0, 255],
  18.   miss:   [255, 0, 0, 255]
  19. }
  20. function getExploitName(index)
  21. {
  22.     var exploitName = "";
  23.     switch(index)
  24.     {
  25.         case 0:
  26.             exploitName = "NO";
  27.             break;
  28.         case 1:
  29.             exploitName = "HIDE SHOTS";
  30.             break;
  31.         case 2:
  32.             exploitName = "DOUBLE TAP";
  33.             break;
  34.         default:
  35.             exploitName = "undefined";
  36.             break;
  37.     }
  38.     return exploitName;
  39. }
  40. function getSafePointName(index)
  41. {
  42.     var exploitName = "";
  43.     switch(index)
  44.     {
  45.         case 0:
  46.             exploitName = "NO";
  47.             break;
  48.         case 1:
  49.             exploitName = "YES";
  50.             break;
  51.         default:
  52.             exploitName = "undefined";
  53.             break;
  54.     }
  55.     return exploitName;
  56. }
  57. function getHitboxName(index)
  58. {
  59.     var hitboxName = "";
  60.     switch (index)
  61.     {
  62.         case 0:
  63.             hitboxName = "Head";
  64.             break;
  65.         case 1:
  66.             hitboxName = "Neck";
  67.             break;
  68.         case 2:
  69.             hitboxName = "Pelvis";
  70.             break;
  71.         case 3:
  72.             hitboxName = "Body";
  73.             break;
  74.         case 4:
  75.             hitboxName = "Thorax";
  76.             break;
  77.         case 5:
  78.             hitboxName = "Chest";
  79.             break;
  80.         case 6:
  81.             hitboxName = "Upper chest";
  82.             break;
  83.         case 7:
  84.             hitboxName = "Left thigh";
  85.             break;
  86.         case 8:
  87.             hitboxName = "Right thigh";
  88.             break;
  89.         case 9:
  90.             hitboxName = "Left calf";
  91.             break;
  92.         case 10:
  93.             hitboxName = "Right calf";
  94.             break;
  95.         case 11:
  96.             hitboxName = "Left foot";
  97.             break;
  98.         case 12:
  99.             hitboxName = "Right foot";
  100.             break;
  101.         case 13:
  102.             hitboxName = "Left hand";
  103.             break;
  104.         case 14:
  105.             hitboxName = "Right hand";
  106.             break;
  107.         case 15:
  108.             hitboxName = "Left upper arm";
  109.             break;
  110.         case 16:
  111.             hitboxName = "Left forearm";
  112.             break;
  113.         case 17:
  114.             hitboxName = "Right upper arm";
  115.             break;
  116.         case 18:
  117.             hitboxName = "Right forearm";
  118.             break;
  119.         default:
  120.             hitboxName = "undefined";
  121.     }
  122.  
  123.     return hitboxName;
  124. }
  125.  
  126. function HSVtoRGB(h, s, v) {
  127.   var r, g, b, i, f, p, q, t;
  128.   if (arguments.length === 1) {
  129.     s = h.s, v = h.v, h = h.h;
  130.   }
  131.   i = Math.floor(h * 6);
  132.   f = h * 6 - i;
  133.   p = v * (1 - s);
  134.   q = v * (1 - f * s);
  135.   t = v * (1 - (1 - f) * s);
  136.   switch (i % 6) {
  137.     case 0: r = v, g = t, b = p; break;
  138.     case 1: r = q, g = v, b = p; break;
  139.     case 2: r = p, g = v, b = t; break;
  140.     case 3: r = p, g = q, b = v; break;
  141.     case 4: r = t, g = p, b = v; break;
  142.     case 5: r = v, g = p, b = q; break;
  143.   }
  144.   return {
  145.     r: Math.round(r * 255),
  146.     g: Math.round(g * 255),
  147.     b: Math.round(b * 255)
  148.   };
  149. }
  150. function getCustomValue(field) {
  151.   var value = UI.GetValue("MISC", "JAVASCRIPT", "Script items", field);
  152.   return value;
  153. }
  154. function cursorConstruct(array) {
  155.   if (typeof array !== 'object') {
  156.     return null;
  157.   }
  158.   return {
  159.     x: array[0],
  160.     y: array[1]
  161.   };
  162. }
  163. function onObject(cursor, position, width, heigth) {
  164.   if (!cursor || !position || !width || !heigth) {
  165.     return;
  166.   }
  167.   return cursor.x <= position.x + width && cursor.x >= position.x
  168.     && cursor.y <= position.y + heigth && cursor.y >= position.y;
  169. }
  170. function colorByDamage(damage) {
  171.   if (damage > 90) {
  172.     return damageColors.lethal
  173.   } else if (damage < 90 && damage > 49) {
  174.     return damageColors.semi
  175.   } else if (damage < 49 && damage > 20) {
  176.     return damageColors.half
  177.   } else if (damage > 0) {
  178.     return damageColors.miss;
  179.   } else {
  180.     return damageColors.miss;
  181.   }
  182. }
  183. function render() {
  184.   var visible = getCustomValue('Hit List');
  185.   UI.SetEnabled('Script Items', 'update every round', visible);
  186.   //UI.SetEnabled('Script Items', 'misc logs', visible);
  187.  
  188.   var customAlphaEnabled = getCustomValue('custom alpha');
  189.   UI.SetEnabled('Script Items', 'alpha header', customAlphaEnabled);
  190.   UI.SetEnabled('Script Items', 'alpha background', customAlphaEnabled);
  191.   var customPositionEnabled = getCustomValue('position by pixels');
  192.   UI.SetEnabled('Script Items', 'position x', customPositionEnabled);
  193.   UI.SetEnabled('Script Items', 'position y', customPositionEnabled);
  194.  
  195.   if (!visible) {
  196.     return;
  197.   }
  198.   rgbline = getCustomValue('Line Position');
  199.   namesize = getCustomValue('Name Size');
  200.   coloredsize = getCustomValue('Colored Size');
  201.   dmgsize = getCustomValue('DMG Size');
  202.   hitboxsize = getCustomValue('Hitbox Size');
  203.   exploitsize = getCustomValue('Exploit Size');
  204.   safepointssize = getCustomValue('Safepoints Size');
  205.   hitchancesize = getCustomValue('Hitchance Size');
  206.   linesize = getCustomValue('Line Size');
  207.   boxsize = getCustomValue('Box Size');
  208.   tickcount = Global.Tickcount();
  209.   position.x = getCustomValue('position x');
  210.   position.y = getCustomValue('position y');
  211.   alphaH = getCustomValue('alpha header');
  212.   alphaB = getCustomValue('alpha background');
  213.   if (UI.IsMenuOpen()) {
  214.     var cursor = cursorConstruct(Global.GetCursorPosition());
  215.     if (cursor && Global.IsKeyPressed(0x01)) {
  216.       if (onObject(cursor, position, boxsize, 160)) {
  217.         UI.SetValue('Script Items', 'position x', cursor.x - boxsize / 2);
  218.         UI.SetValue('Script Items', 'position y', cursor.y - 160 / 2);
  219.       }
  220.     }
  221.   }
  222.   color = HSVtoRGB(tickcount % 350 / 350, 1, 1, 1, 255);
  223.   Render.FilledRect(position.x, position.y, boxsize, 20, [0, 0, 0, alphaH]);
  224.   Render.FilledRect(position.x, position.y + 20, boxsize, 140, [0, 0, 0, alphaB]);
  225.   if(namesize != 0) { Render.String(position.x + namesize, position.y + 5, 0, "NAME", [255, 255, 255, 255], 8); }
  226.   if(dmgsize != 0) { Render.String(position.x + dmgsize, position.y + 5, 0, "DMG", [255, 255, 255, 255], 8); }
  227.   if(hitboxsize != 0) { Render.String(position.x + hitboxsize, position.y + 5, 0, "HITBOX", [255, 255, 255, 255], 8); }
  228.   if(exploitsize != 0) { Render.String(position.x + exploitsize, position.y + 5, 0, "EXPLOIT", [255, 255, 255, 255], 8); }
  229.   if(safepointssize != 0) { Render.String(position.x + safepointssize, position.y + 5, 0, "SAFEPOINTS", [255, 255, 255, 255], 8); }
  230.   if(hitchancesize != 0) { Render.String(position.x + hitchancesize, position.y + 5, 0, "HITCHANCE", [255, 255, 255, 255], 8); }
  231.   boxsize2 = boxsize / 2
  232.   if (boxsize != 0 && linesize != 0) { Render.Line(position.x + boxsize2 - linesize, position.y + rgbline, position.x-1 + linesize + boxsize2, position.y + rgbline, [color.r, color.g, color.b, 255]); }
  233.   for (var i = logs.slice(-7).length, j = 0; i > 0; i-- , j++) {
  234.     // brain issue, sry
  235.     if (j > 6) {
  236.       j = 0;
  237.     }
  238.     var log = logs.slice(-7)[i - 1];
  239.     if (!log.type && coloredsize != 0) {
  240.       Render.FilledRect(position.x + coloredsize-3, position.y + 20 * (j + 1.25), 2, 10.5, colorByDamage(log.damage));
  241.     }
  242.     if(namesize != 0) { Render.String(position.x + namesize, position.y + 20 * (j + 1.25), 0, log.name.slice(0, getCustomValue('Max Name Size')), [255, 255, 255, 255], 8); }
  243.     if(dmgsize != 0) { Render.String(position.x + dmgsize, position.y + 20 * (j + 1.25), 0, String(log.damage), [255, 255, 255, 255], 8); }
  244.     if(hitboxsize != 0) { Render.String(position.x + hitboxsize, position.y + 20 * (j + 1.25), 0, log.hitbox, [255, 255, 255, 255], 8); }
  245.     if(exploitsize != 0) { Render.String(position.x + exploitsize, position.y + 20 * (j + 1.25), 0, log.exploit, [255, 255, 255, 255], 8); }
  246.     if(safepointssize != 0) { Render.String(position.x + safepointssize, position.y + 20 * (j + 1.25), 0, String(log.safepoint), [255, 255, 255, 255], 8); }
  247.     if(hitchancesize != 0) { Render.String(position.x + hitchancesize, position.y + 20 * (j + 1.25), 0, String(log.hitchance), [255, 255, 255, 255], 8); }
  248.   }
  249.   if (logs.length > 7) {
  250.     logs.shift();
  251.   }
  252. }
  253.  
  254.  
  255. function roundStartListener() {
  256.   if (!getCustomValue('update every round')) {
  257.     return;
  258.   }
  259.   logs = [];
  260. }
  261. function roundEndListener() {
  262.   if (getCustomValue('misc logs') != 1) {
  263.     return;
  264.   }
  265.   logs.push({
  266.     name: 'Round ended',
  267.     hitbox: '',
  268.     hitchance: '',
  269.     exploit: '',
  270.     type: 'roundEnd'
  271.   });
  272. }
  273.  
  274. function ragebotLogs() {
  275.     ragebot_target = Event.GetInt("target_index");
  276.     ragebot_target_hitbox = Event.GetInt("hitbox");
  277.     ragebot_target_hitchance = Event.GetInt("hitchance");
  278.     ragebot_target_safepoint = Event.GetInt("safepoint");
  279.     ragebot_target_exploit = Event.GetInt("exploit");
  280.     targetName = Entity.GetName(ragebot_target);
  281. }
  282. function hurt() {
  283.     damagee = 0;
  284.     damagee = Event.GetInt("dmg_health");
  285.     var me = Entity.GetLocalPlayer();
  286.     var victim = Event.GetInt('userid');
  287.     var attacker = Event.GetInt('attacker');
  288.     var victimIndex = Entity.GetEntityFromUserID(victim);
  289.     var attackerIndex = Entity.GetEntityFromUserID(attacker);
  290.     var name = Entity.GetName(victimIndex);
  291.     newlog(targetName, ragebot_target_hitbox, ragebot_target_hitchance, ragebot_target_safepoint, ragebot_target_exploit, damagee);
  292. }
  293. function newlog(name1, hitbox1, hitchance1, safepoint1, exploit1, damage1)
  294. {
  295.         logs.push({
  296.           name: name1,
  297.           hitbox: getHitboxName(hitbox1),
  298.           hitchance: hitchance1,
  299.           safepoint: getSafePointName(safepoint1),
  300.           exploit: getExploitName(exploit1),
  301.           damage: damage1
  302.         });
  303. }
  304.  
  305.  
  306. function main() {
  307.   var sizes = Global.GetScreenSize();
  308.   UI.AddLabel("---- HIT LIST ----")
  309.   UI.AddSliderInt('Max Name Size', 0, 20);
  310.   UI.AddSliderInt('Line Position', 0, 159);
  311.   UI.AddSliderInt('Colored Size', 0, 1000);
  312.   UI.AddSliderInt('Name Size', 0, 1000);
  313.   UI.AddSliderInt('DMG Size', 0, 1000);
  314.   UI.AddSliderInt('Hitbox Size', 0, 1000);
  315.   UI.AddSliderInt('Exploit Size', 0, 1000);
  316.   UI.AddSliderInt('Safepoints Size', 0, 1000);
  317.   UI.AddSliderInt('Hitchance Size', 0, 1000);
  318.   UI.AddSliderInt('Line Size', 0, 1000);
  319.   UI.AddSliderInt('Box Size', 0, 1000);
  320.   UI.AddCheckbox('Hit List');
  321.   UI.AddCheckbox('update every round');
  322.   // Misc logs
  323.   /*UI.AddMultiDropdown('misc logs', [
  324.     'round end'
  325.   ]);*/
  326.   UI.AddCheckbox('custom alpha');
  327.   UI.AddSliderInt('alpha header', 0, 255);
  328.   UI.AddSliderInt('alpha background', 0, 255);
  329.   // Position
  330.   UI.AddCheckbox('position by pixels');
  331.   UI.AddSliderInt('position x', 0, sizes[0]);
  332.   UI.AddSliderInt('position y', 0, sizes[1]);
  333.   UI.AddLabel("---- HIT LIST END ----")
  334.   Global.RegisterCallback('Draw', 'render');
  335.   Global.RegisterCallback("player_hurt", "hurt");
  336.   //Global.RegisterCallback("weapon_fire", "tracebullet");
  337.   Global.RegisterCallback("ragebot_fire", "ragebotLogs");
  338.   Global.RegisterCallback('round_start', 'roundStartListener');
  339.   Global.RegisterCallback('round_end', 'roundEndListener');
  340. }
  341. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement