SHARE
TWEET

tu dziala

a guest Feb 18th, 2020 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var binlib = {};
  2.  
  3. function dictLength(dict) {
  4.     var count = 0;
  5.     for (_ in dict) {
  6.         count++;
  7.     }
  8.     return count;
  9. }
  10.  
  11. function createDropdown(name, values, multi) {
  12.     UI[multi ? "AddMultiDropdown" : "AddDropdown"](name, values);
  13.    
  14.     binlib[name] = {"multi": multi, "values": {}};
  15.  
  16.     multi && values.reverse();
  17.  
  18.     var i = 0; for (value in values) {
  19.         var index = multi ? (1 << (values.length-(i+1))) : i;
  20.         binlib[name].values[index] = values[value];
  21.         i++;
  22.     }
  23. }
  24.  
  25. function fetchDropdown(name) {
  26.     var selection = (name ? [] : {})
  27.     var bin = get(["Script Items", name]);
  28.  
  29.     !name && function() {for (dropdown in binlib) selection[dropdown] = fetchDropdown(dropdown) }();
  30.  
  31.     if (!name) return;
  32.     !binlib[name].multi && bin == 0 && selection.push(binlib[name].values[0]) && function() { return selection; }();
  33.     for (var i = dictLength(binlib[name].values)-1; i >= 0; i--) {
  34.         if (!binlib[name].multi && i == 0) continue;
  35.  
  36.         var index = binlib[name].multi ? (1 << i) : i;
  37.         if (bin-index >= 0) {
  38.             bin -= (index);
  39.             selection.push(binlib[name].values[index]);
  40.         }
  41.     }
  42.  
  43.     return selection;
  44. }
  45.  
  46. function get(item) {
  47.     return UI.GetValue.apply(this, item);
  48. }
  49.  
  50. function set(path, val) {
  51.     return UI.SetValue(path, val);
  52. }
  53.  
  54. function overflow(num, min, max) {
  55.     var v = num > max ? min+(num-max) : num < min ? max-(min-num) : num
  56.     if (v > max || v < min) v = overflow(v, min, max);
  57.     return v;
  58. }
  59.  
  60. var settings = {
  61.     primary: [250, 161, 255, 255],
  62.     secondary: [255, 255, 255, 255],
  63.     font: 0,
  64.  
  65.     style: 0, // 0 = Constrained, 1 = Opposites
  66.     dir: 0, // 0 = Left, 1 = Back, 2 = Right
  67.     cycle: false,
  68.     iteration: 0,
  69.     rot: 0,
  70.  
  71.     ywidth: 0,
  72.     yrandom: 0,
  73.     jenabled: false,
  74.     jwidth: 0,
  75.     jrandom: 0,
  76.     jnth: 1,
  77.     spin: 0,
  78.  
  79.     vTotal: 0,
  80.     vArrows: false,
  81.     vCycle: false,
  82.     vInverted: false,
  83.     vWASD: false,
  84.     vDeg: false,
  85.    
  86.     frequency: 0,
  87.  
  88.     offset: 0,
  89.     lbyenabled: false,
  90.     lbyexclude: [],
  91.     lbyinclude: [],
  92.     lbylast: -1,
  93.     lbynth: 1,
  94.  
  95.     iTotal: 0,
  96.     iCycle: false,
  97.     iTaken: false,
  98.     iDealt: false,
  99.     iShot: false,
  100.     iStep: false,
  101.     cyclenth: 1
  102. }, ui = {};
  103.  
  104. function setupUI() {
  105.     UI.AddLabel("====== polak Jitter v2.1 ======");
  106.     UI.AddLabel("---------------- Visuals ----------------");
  107.     ui.primary = UI.AddColorPicker("Primary Color");
  108.     ui.secondary = UI.AddColorPicker("Secondary Color");
  109.     createDropdown("Visuals", ["Arrows", "Cycle", "Inverted", "WASD", "Degree"], true);
  110.     ui.font = UI.AddDropdown("Font", ["Normal", "Small", "Big"]);
  111.     ui.bold = UI.AddCheckbox("Bold");
  112.     UI.AddLabel("----------------- Jitter -----------------");
  113.     createDropdown("Style", ["Constrained", "Opposites"], false);
  114.     ui.left = UI.AddHotkey("Face Left");
  115.     ui.back = UI.AddHotkey("Face Back");
  116.     ui.right = UI.AddHotkey("Face Right");
  117.     ui.ywidth = UI.AddSliderInt("Yaw Width", 0, 180);
  118.     ui.yrandom = UI.AddSliderInt("Yaw Randomize", 0, 180);
  119.     ui.spin = UI.AddSliderInt("Spin Speed", 0, 25);
  120.     ui.jenabled = UI.AddCheckbox("Offset Jitter");
  121.     ui.jwidth = UI.AddSliderInt("Jitter Width", 0, 180);
  122.     ui.jrandom = UI.AddSliderInt("Jitter Randomize", 0, 180);
  123.     ui.jnth = UI.AddSliderInt("Offset Jitter Every nth Cycle", 1, 300);
  124.     UI.AddLabel("----------------- Misc -----------------");
  125.     ui.cycle = UI.AddSliderInt("Cycle Frequency", 1, 100);
  126.     UI.AddLabel("---------------- Angles ----------------");
  127.     ui.offset = UI.AddSliderInt("Yaw Offset", -180, 180);
  128.     ui.lbyenabled = UI.AddCheckbox("LBY Jitter");
  129.     createDropdown("Exclude LBY Modes", ["Normal", "Opposite", "Sway"], true);
  130.     ui.lbynth = UI.AddSliderInt("Jitter LBY Every nth Cycle", 1, 300);
  131.     UI.AddLabel("--------------- Inversion ---------------");
  132.     createDropdown("Auto-Invert Flags", ["Cycle", "Damage Taken", "Damage Dealt", "On Shot", "On Footstep"], true);
  133.     ui.cyclenth = UI.AddSliderInt("Invert Every nth Cycle", 1, 200);
  134.     UI.AddLabel("=======================");
  135.  
  136.     UI.SetColor("Script Items", "Primary Color", settings.primary);
  137.     UI.SetColor("Script Items", "Secondary Color", settings.secondary);
  138.     UI.SetEnabled("Script Items", "Font", false);
  139.     UI.SetEnabled("Script Items", "Bold", false);
  140.     UI.SetEnabled("Script Items", "Spin Speed", false);
  141.     UI.SetEnabled("Script Items", "Jitter Width", false);
  142.     UI.SetEnabled("Script Items", "Jitter Randomize", false);
  143.     UI.SetEnabled("Script Items", "Offset Jitter Every nth Cycle", false);
  144.     set(ui.offset, 0);
  145.     UI.SetEnabled("Script Items", "Exclude LBY Modes", false);
  146.     UI.SetEnabled("Script Items", "Jitter LBY Every nth Cycle", false);
  147.     UI.SetEnabled("Script Items", "Invert Every nth Cycle", false);
  148. }
  149.  
  150. function info() {
  151.     Render.String(0, 400, 0, "rychu peja", UI.GetColor("Script Items", "Primary Color", settings.primary), 1);
  152.     Render.String(0, 412, 0, "poweraded by hentaiware", [255, 255, 255, 255], 1);
  153.     Render.String(0, 424, 0, "jebac lubana au", [255, 255, 255, 255], 1);
  154.     Render.String(0, 436, 0, "", [255, 255, 255, 255], 1);
  155.     Render.String(0, 448, 0, "", [255, 255, 255, 255], 1);
  156.     Render.String(0, 472, 0, "", UI.GetColor("Script Items", "Primary Color", settings.primary), 1);
  157. }
  158.  
  159. function menuLogic() {
  160.     if (!UI.IsMenuOpen()) return;
  161.    
  162.     var visualFlags = fetchDropdown("Visuals");
  163.     settings.vTotal = visualFlags.length;
  164.     settings.vArrows = visualFlags.indexOf("Arrows") > -1;
  165.     settings.vCycle = visualFlags.indexOf("Cycle") > -1;
  166.     settings.vInverted = visualFlags.indexOf("Inverted") > -1;
  167.     settings.vWASD = visualFlags.indexOf("WASD") > -1;
  168.     settings.vDeg = visualFlags.indexOf("Degree") > -1;
  169.  
  170.     settings.primary = UI.GetColor.apply(this, ui.primary);
  171.     settings.secondary = UI.GetColor.apply(this, ui.secondary);
  172.     settings.font = get(["Script Items", "Font"]) == 2 ? 4 : get(["Script Items", "Font"])*2 + get(["Script Items", "Bold"]);
  173.  
  174.     settings.style = fetchDropdown("Style").indexOf("Constrained") > -1 ? 0 : 1;
  175.     settings.ywidth = get(ui.ywidth);
  176.     settings.yrandom = get(ui.yrandom);
  177.     settings.jenabled = get(ui.jenabled);
  178.     settings.spin = get(ui.spin);
  179.     settings.jwidth = get(ui.jwidth);
  180.     settings.jrandom = get(ui.jrandom);
  181.     settings.jnth = get(ui.jnth);
  182.    
  183.     settings.frequency = get(ui.cycle);
  184.  
  185.     settings.offset = get(ui.offset);
  186.     settings.lbyenabled = get(ui.lbyenabled);
  187.     var lby = fetchDropdown("Exclude LBY Modes");
  188.     if (settings.lbyexclude.length == 2 && lby.length == 3) {
  189.         var newVal = 0;
  190.         for (v in binlib["Exclude LBY Modes"].values) {
  191.             if (settings.lbyexclude.indexOf(binlib["Exclude LBY Modes"].values[v]) > -1) {
  192.                 newVal += parseInt(v);
  193.             }
  194.         }
  195.         UI.SetValue("Exclude LBY Modes", newVal);
  196.     } else {
  197.         settings.lbyexclude = lby;
  198.     }
  199.     var include = [];
  200.     for (v in binlib["Exclude LBY Modes"].values) {
  201.         if (settings.lbyexclude.indexOf(binlib["Exclude LBY Modes"].values[v]) == -1) include.push(v >> 1);
  202.     }
  203.     settings.lbyinclude = include;
  204.     settings.lbynth = get(ui.lbynth);
  205.  
  206.     var invertFlags = fetchDropdown("Auto-Invert Flags");
  207.     settings.iTotal = invertFlags.length;
  208.     settings.iCycle = invertFlags.indexOf("Cycle") > -1;
  209.     settings.iTaken = invertFlags.indexOf("Damage Taken") > -1;
  210.     settings.iDealt = invertFlags.indexOf("Damage Dealt") > -1;
  211.     settings.iShot = invertFlags.indexOf("On Shot") > -1;
  212.     settings.iStep = invertFlags.indexOf("On Footstep") > -1;
  213.     settings.cyclenth = get(ui.cyclenth);
  214.  
  215.     var text = visualFlags.length-(settings.vArrows ? 1 : 0) > 0;
  216.     UI.SetEnabled("Script Items", "Font", text);
  217.     UI.SetEnabled("Script Items", "Bold", text && settings.font != 4);
  218.  
  219.     var constrained = settings.style == 0;
  220.     UI.SetEnabled("Script Items", "Face Left", constrained);
  221.     UI.SetEnabled("Script Items", "Face Back", constrained);
  222.     UI.SetEnabled("Script Items", "Face Right", constrained);
  223.     UI.SetEnabled("Script Items", "Yaw Width", constrained);
  224.     UI.SetEnabled("Script Items", "Yaw Randomize", constrained);
  225.     UI.SetEnabled("Script Items", "Spin Speed", !constrained);
  226.     UI.SetEnabled("Script Items", "Jitter Width", get(ui.jenabled));
  227.     UI.SetEnabled("Script Items", "Jitter Randomize", get(ui.jenabled));
  228.     UI.SetEnabled("Script Items", "Offset Jitter Every nth Cycle", get(ui.jenabled));
  229.  
  230.     UI.SetEnabled("Script Items", "Exclude LBY Modes", get(ui.lbyenabled));
  231.     UI.SetEnabled("Script Items", "Jitter LBY Every nth Cycle", get(ui.lbyenabled));
  232.  
  233.     UI.SetEnabled("Script Items", "Invert Every nth Cycle", settings.iCycle);
  234.  
  235.     info();
  236. }
  237.  
  238. function visuals() {
  239.     if (settings.vTotal == 0 || !Entity.IsAlive(Entity.GetLocalPlayer())) return;
  240.  
  241.     var x = Global.GetScreenSize()[0]/2, y = Global.GetScreenSize()[1]/2;
  242.     var fOffset = Render.TextSize("P", settings.font)[1]*.7;
  243.  
  244.     if (settings.vArrows) {
  245.         var colors = [settings.secondary, settings.secondary, settings.secondary]
  246.         if (settings.style == 0) {
  247.             colors[settings.dir] = settings.primary;
  248.         } else {
  249.             if (UI.IsHotkeyActive("Fake angles", "Inverter")) colors[0] = settings.primary;
  250.             else colors[2] = settings.primary;
  251.         }
  252.  
  253.         Render.String(x-50, y-20, 1, "<", colors[0], 4);
  254.         Render.String(x, y+30, 1, settings.style == 0 ? "v" : "", colors[1], 4);
  255.         Render.String(x+50, y-20, 1, ">", colors[2], 4);
  256.  
  257.         y += settings.style == 0 ? 60 : 30;
  258.     }
  259.  
  260.     if (settings.vCycle) {
  261.         Render.String(x, y, 0, "CYCLE", settings.cycle ? settings.primary : settings.secondary, settings.font);
  262.  
  263.         y += fOffset;
  264.     }
  265.  
  266.     if (settings.vInverted) {
  267.         Render.String(x, y, 0, "INVERTED", UI.IsHotkeyActive("Fake angles", "Inverter") ? settings.primary : settings.secondary, settings.font);
  268.  
  269.         y += fOffset;
  270.     }
  271.  
  272.     if (settings.vWASD) {
  273.         Render.String(x, y, 0, "W", Global.IsKeyPressed(0x57) ? settings.primary : settings.secondary, settings.font);
  274.         Render.String(x+Render.TextSize("W", settings.font)[0], y, 0, "A", Global.IsKeyPressed(0x41) ? settings.primary : settings.secondary, settings.font);
  275.         Render.String(x+Render.TextSize("WA", settings.font)[0], y, 0, "S", Global.IsKeyPressed(0x53) ? settings.primary : settings.secondary, settings.font);
  276.         Render.String(x+Render.TextSize("WAS", settings.font)[0], y, 0, "D", Global.IsKeyPressed(0x44) ? settings.primary : settings.secondary, settings.font);
  277.  
  278.         y += fOffset;
  279.     }
  280.  
  281.     if (settings.vDeg) {
  282.         Render.String(x, y, 0, "DEG: " + get(["Yaw offset"]), settings.secondary, settings.font);
  283.     }
  284. }
  285.  
  286. function jitter() {
  287.     settings.iteration++;
  288.     if (UI.IsHotkeyActive("Script Items", "Face Left")) settings.dir = 0;
  289.     else if (UI.IsHotkeyActive("Script Items", "Face Back")) settings.dir = 1;
  290.     else if (UI.IsHotkeyActive("Script Items", "Face Right")) settings.dir = 2;
  291.    
  292.     if (!Entity.IsAlive(Entity.GetLocalPlayer()) || settings.iteration%(settings.frequency+1) != 0) return;
  293.     settings.cycle = !settings.cycle;
  294.  
  295.     if (settings.style == 0) {
  296.         var ang = 0;
  297.  
  298.         if (settings.dir == 0) ang = settings.cycle ? -90 : settings.ywidth-90;
  299.         else if (settings.dir == 1) ang = settings.cycle ? settings.ywidth/2 : -(settings.ywidth/2);
  300.         else if (settings.dir == 2) ang = settings.cycle ? 90 : 90-settings.ywidth;
  301.  
  302.         var offset = settings.offset;
  303.         if (offset != 0) offset = offset > 0 ? overflow(offset, 0, 180) : overflow(offset, -180, 0);
  304.  
  305.         set("Yaw offset", ang+(~~(Math.random() * settings.yrandom)-settings.yrandom)+offset);
  306.     } else {
  307.         settings.rot += settings.spin;
  308.         if (settings.spin == 0) settings.rot = 0;
  309.        
  310.         if (UI.IsHotkeyActive("Fake angles", "Inverter")) UI.SetValue("Yaw offset", settings.cycle ? overflow(180+settings.rot+settings.offset, 0, 180)-180 : overflow(180+settings.rot+settings.offset, 0, 180));
  311.         else UI.SetValue("Yaw offset", settings.cycle ? 180-overflow(180+settings.rot+settings.offset, 0, 180) : -overflow(180+settings.rot+settings.offset, 0, 180));
  312.     }
  313.  
  314.     if (settings.jenabled && settings.iteration%settings.jnth == 0) {
  315.         set("Jitter offset", (settings.cycle ? settings.jwidth : -settings.jwidth)+(~~(Math.random() * settings.jrandom)-settings.jrandom));
  316.     }
  317.    
  318.     if (settings.lbyenabled && settings.iteration%settings.lbynth == 0) {
  319.         settings.lbylast = overflow(settings.lbylast+1, -1, settings.lbyinclude.length-1);
  320.         UI.SetValue("LBY mode", settings.lbyinclude[settings.lbylast]);
  321.     }
  322.  
  323.     if (settings.iCycle && settings.iteration%settings.cyclenth == 0) UI.ToggleHotkey("Fake angles", "Inverter");
  324. }
  325.  
  326. function damage() {
  327.     if ((!settings.iTaken && !settings.iDealt) || !Entity.IsAlive(Entity.GetLocalPlayer())) return;
  328.     var vic = Entity.GetEntityFromUserID(Event.GetInt("userid"));
  329.     var atck = Entity.GetEntityFromUserID(Event.GetInt("attacker"));
  330.     var locp = Entity.GetLocalPlayer()
  331.  
  332.     if ((vic != locp && atck != locp) || vic == atck) return;
  333.  
  334.     if (settings.iTaken && vic == locp) UI.ToggleHotkey("Fake angles", "Inverter");
  335.     if (settings.iDealt && atck == locp) UI.ToggleHotkey("Fake angles", "Inverter");
  336. }
  337.  
  338. function shot() {
  339.     if (settings.iShot) UI.ToggleHotkey("Fake angles", "Inverter");
  340. }
  341.  
  342. function step() {
  343.     if (settings.iStep && Entity.GetEntityFromUserID(Event.GetInt("userid")) == Entity.GetLocalPlayer()) UI.ToggleHotkey("Fake angles", "Inverter");
  344. }
  345.  
  346. function main() {
  347.     setupUI();
  348.     Global.RegisterCallback("Draw", "menuLogic");
  349.     Global.RegisterCallback("Draw", "visuals");
  350.     Global.RegisterCallback("CreateMove", "jitter");
  351.     Global.RegisterCallback("player_hurt", "damage");
  352.     Global.RegisterCallback("ragebot_fire", "shot");
  353.     Global.RegisterCallback("player_footstep", "step");
  354. } main();
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
Top