SenkoTech dev
-
Автор темы
- #1
Переделка биндов, которые пытался сделать Mased, но получилось так, что сделал я их лучше, because делать нехер..
Source code:
Download:
Source code:
JavaScript:
var menu = {}, ui = { label: UI.AddLabel, switch: UI.AddCheckbox, color: UI.AddColorPicker, slider: UI.AddSliderInt, sliderint: UI.AddSliderInt, sliderfloat: UI.AddSliderFloat, dropdown: UI.AddDropdown, multidropdown: UI.AddMultiDropdown, textbox: UI.AddTextbox, hotkey: UI.AddHotkey }
menu.new = function(func, name, properties, initial_value, hide) { properties = properties || []; initial_value = initial_value || undefined; hide = hide || false; var final_name = name; var final_props = [final_name]; const element_info_t = { path: ["Misc", "JAVASCRIPT", "Script Items", final_name], cache: initial_value, func: func, hide: hide }; if(properties != null) { for (var i = 0; i < properties.length; i++) { final_props.push(properties[i]) } } func.apply(null, final_props); if(hide == 'force') { UI.SetEnabled.apply(null, this.concat(element_info_t.path, false)) }; if(initial_value) { switch(func) { case UI.AddColorPicker: UI.SetColor.apply(null, this.concat(element_info_t.path, initial_value)); break; case UI.AddHotkey: break; default: UI.SetValue.apply(this, this.concat(element_info_t.path, initial_value)); break; } } return element_info_t };
menu.concat = function(a, b) { var arr = []; for (var c in a) { arr.push(a[c]); } arr.push(b); return arr }
menu.path = function(path) { return { path: path } };
menu.get = function(elem) { if(!(elem.path)) throw new Error("[Menu] This element doesn't exist!"); switch (elem.func) { case UI.AddColorPicker: return UI.GetColor.apply(null, elem.path); case UI.AddTextbox: return UI.GetString.apply(null, elem.path); case UI.AddHotkey: return UI.IsHotkeyActive.apply(null, elem.path); default: return UI.IsHotkeyActive.apply(null, elem.path) != null ? UI.IsHotkeyActive.apply(null, elem.path) : UI.GetValue.apply(null, elem.path) != null ? UI.GetValue.apply(null, elem.path) : false } }
menu.get_color = function(elem) { if(!(elem.path)) throw new Error("[Menu] This element doesn't exist!"); return UI.GetColor.apply(null, elem.path) };
menu.get_hotkey = function(elem) { if(!(elem.path)) throw new Error("[Menu] This element doesn't exist!"); return UI.IsHotkeyActive.apply(null, elem.path) };
menu.set = function(elem, value) { if(!(elem.path)) throw new Error("[Menu] This element doesn't exist!"); switch (elem.func) { case UI.AddColorPicker: UI.SetColor.apply(null, this.concat(elem.path, value)); break; case UI.AddHotkey: if (menu.get(elem) !== value) UI.ToggleHotkey.apply(null, elem.path); break; default: UI.SetValue.apply(null, this.concat(elem.path, value)); break; } };
menu.visible = function(elem, value) { if(!(elem.path)) throw new Error("[Menu] This element doesn't exist!"); UI.SetEnabled.apply(null, this.concat(elem.path, value)) };
menu.GetBinds = function() { var active = []; for (var i in binds) { binds[i][3] = Math.lerp(binds[i][3], menu.get(binds[i][2]) ? 255 : 0, 0.095); if(binds[i][3] > 1) active.push([binds[i][0], binds[i][1], binds[i][3]]) }; return active }
Math.clamp = function(val, min, max) { return Math.min(Math.max(val, min), max) }
Math.lerp = function(start, end, time, do_extraanim) { if(!do_extraanim && Math.floor(start) == end) return end; time = Global.Frametime() * (time * 175); if(time < 0) time = 0.01; else if(time > 1) time = 1; return (end - start) * time + start }
Render.Drag = function(x, y, w, h, name, cache, reset) { var mouse = { x: Global.GetCursorPosition()[0], y: Global.GetCursorPosition()[1] }; if(Global.IsKeyPressed(0x01)) { if(mouse.x >= x && mouse.x <= x + w && mouse.y >= y && mouse.y <= y + h) { if(!cache[2]) { cache[0] = x - mouse.x; cache[1] = y - mouse.y; cache[2] = !grab ? true : false; }; grab = true } }else{ cache[2] = false; grab = false }; if(cache[2] && UI.IsMenuOpen()) { menu.set(name[0], mouse.x + cache[0]); menu.set(name[1], mouse.y + cache[1]) }else{ if(reset) { if(x < 0) menu.set(name[0], 0); if(y < 0) menu.set(name[1], 0); if(x > Render.GetScreenSize()[0] - w) menu.set(name[0], Render.GetScreenSize()[0] - w); if(y > Render.GetScreenSize()[1] - h) menu.set(name[1], Render.GetScreenSize()[1] - h); } } }
var local = Entity.GetLocalPlayer(), screen_size = Render.GetScreenSize()
var path = {
DT: menu.path(["Rage", "Exploits", "Doubletap"]),
HS: menu.path(["Rage", "Exploits", "Hide shots"]),
BAIM: menu.path(["Rage", "GENERAL", "General", "Force body aim"]),
SP: menu.path(["Rage", "GENERAL", "General", "Force safe point"]),
RO: menu.path(["Rage", "General", "Resolver override"]),
SW: menu.path(["Anti-Aim", "Extra", "Slow walk"]),
INVERTER: menu.path(["Anti-Aim", "Fake angles", "Inverter"]),
AP: menu.path(["Misc", "Movement", "Auto peek"]),
EJ: menu.path(["Misc", "Movement", "Edge jump"]),
FD: menu.path(["Anti-Aim", "Extra", "Fake duck"]),
SLIDE: menu.path(["Misc", "General", "Movement", "Slide walk"]),
TP: menu.path(["Visual", "World", "View", "Thirdperson"]),
}
var binds = [
["Hide Shots", "[always]", path.HS, 0],
["Edge jump", "[always]", path.EJ, 0],
["Double Tap", "[always]", path.DT, 0],
["Slow walk", "[always]", path.SW, 0],
["Invert desync", "[always]", path.INVERTER, 0],
["Fake duck", "[always]", path.FD, 0],
["Automatic peek", "[always]", path.AP, 0],
["Third person", "[always]", path.TP, 0],
["Force baim", "[always]", path.BAIM, 0],
["Force safe point", "[always]", path.SP, 0],
]
var alpha = 0;
var grab = false;
var drag = {
binds: [],
};
for (var i in drag) {
drag[i] = [0, 0, false]
}
const keybinds_x = menu.new(ui.sliderint, "keybinds_x", [0, screen_size[0]], undefined, 'force')
const keybinds_y = menu.new(ui.sliderint, "keybinds_y", [0, screen_size[1]], undefined, 'force')
function on_draw() {
var active = menu.GetBinds()
var pos = [menu.get(keybinds_x), menu.get(keybinds_y)]
var w = 155, h = 20, maxwidth = 0
var font = Render.AddFont('Verdana', 7, 0), icon = Render.AddFont('untitled-font-1', 10, 0)
alpha = Math.lerp(alpha, (active.length != 0 || UI.IsMenuOpen()) ? 255 : 0, 0.1)
if(alpha != 0) {
/* -> Width resize */
for (var i in active) {
if (Render.TextSizeCustom(active[i][0]+" "+active[i][1], font)[0] > maxwidth)
maxwidth = Render.TextSizeCustom(active[i][0]+" "+active[i][1], font)[0];
}
w = Math.clamp(15+maxwidth, 160, screen_size[0]);
/* -> Keybinds system */
for (var i in active) {
text = active[i][0]
state = active[i][1]
add = (active[i][2] /255).toFixed(2)*(alpha/255)
Render.StringCustom(pos[0], pos[1]+h+4 + 17*i, 0, text, [255, 255, 255, 255*add], font)
Render.StringCustom(pos[0]+w-Render.TextSizeCustom(state, font)[0], pos[1]+h+4 + 17*i, 0, state, [255, 255, 255, 255*add], font)
}
/* -> Basic Foundament of keybinds */
Render.FilledRect(pos[0], pos[1], w, h, [0, 0, 0, 125*(alpha/255)])
Render.FilledRect(pos[0], pos[1]+h-2, w, 2, [185, 185, 255, 200*(alpha/255)])
/* -> Basic Text + Icon */
Render.StringCustom(pos[0]+5, pos[1]-1+h/2-Render.TextSizeCustom("a", icon)[1] /2, 0, "a", [185, 185, 255, 255*(alpha/255)], icon)
Render.StringCustom(pos[0]+22, pos[1]-2+h/2-Render.TextSizeCustom("keybinds", font)[1] /2, 0, "keybinds", [255, 255, 255, 255*(alpha/255)], font)
Render.Drag(pos[0], pos[1], w, h, [keybinds_x, keybinds_y], drag.binds, true)
}
}
Cheat.RegisterCallback("Draw", "on_draw")
Вложения
-
2.5 KB Просмотры: 49
-
7.4 KB Просмотры: 34