-
Автор темы
- #1
RU: Приятной игры!
EU: Have a nice game!
JS:
EU: Have a nice game!
JS:
Код:
UI.AddSubTab(["Visuals", "SUBTAB_MGR"], "Helper")
var locations = require("locations\\locations.js")['locations'];
var grenades = locations[World.GetMapName()]
var path = ["Visuals", "Helper", "Helper"]
UI.AddHotkey(["Config", "Scripts", "Keys", "JS Keybinds"], "Throw grenade", "Grenade helper")
UI.AddHotkey(["Config", "Scripts", "Keys", "JS Keybinds"], "Setup grenade", "Setup grenade")
UI.AddColorPicker(path, "Accent color")
UI.AddMultiDropdown(path, "Enabled grenades", ["High Explosive", "Molotov"])
var ui_walls = UI.AddCheckbox(path, "Location through walls")
var ui_arrows = UI.AddCheckbox(path, "Out of FOV arrows")
var ui_key = ["Config", "Scripts", "Keys", "JS Keybinds", "Throw grenade"]
var ui_setup = ["Config", "Scripts", "Keys", "JS Keybinds", "Setup grenade"]
var ui_color = path.concat("Accent color")
var ui_active = path.concat("Enabled grenades")
var screen_size = Render.GetScreenSize();
var center_screen = [screen_size[0]/2, screen_size[1]/2 ]
var vector = {
multiply: function(a, b) {
return [a[0] * b[0], a[1] * b[1], a[2] * b[2]];
},
subtract: function(a, b) {
return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
},
distance: function(a, b) {
var x = a[0] - b[0]
var y = a[1] - b[1]
var z = a[2] - b[2]
return Math.sqrt(x*x + y*y + z*z)
},
length: function(a) {
return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2])
}
}
var vector2d = {
distance: function(a, b) {
var x = a[0] - b[0]
var y = a[1] - b[1]
return Math.sqrt(x*x + y*y)
}
}
function degtorad(degrees) {
return degrees / 180 * Math.PI;
}
function angle_vec(ang) {
var sp = Math.sin(degtorad(ang[0]));
var sy = Math.sin(degtorad(ang[1]));
var cp = Math.cos(degtorad(ang[0]));
var cy = Math.cos(degtorad(ang[1]));
return [cp * cy, cp * sy, -sp];
}
const DIR = {
forward: 0,
left: 1,
right: 2,
back: 3,
}
const STRENGTH = {
high: 0,
mid: 1,
low: 2,
}
const TYPE = {
grenade: "grenade",
}
function can_attack() {
var me = Entity.GetLocalPlayer();
var wpn = Entity.GetWeapon(me);
if (me == null || wpn == null)
return false;
var curtime = Globals.Curtime()
if (curtime < Entity.GetProp(me, "CCSPlayer", "m_flNextAttack"))
return false;
if (curtime < Entity.GetProp(wpn, "CBaseCombatWeapon", "m_flNextPrimaryAttack"))
return false;
return true;
}
function Clamp(num, min, max) {
return num <= min ? min : num >= max ? max : num;
}
function normalize_yaw(angle) {
angle = (angle % 360 + 360) % 360;
return angle > 180 ? angle - 360 : angle;
}
function calculate_yaw(src, to) {
var delta = [src[0] - to[0], src[1] - to[1]]
var yaw = Math.atan(delta[1]/delta[0])
yaw = normalize_yaw(yaw * 180 / Math.PI)
if (delta[0] >= 0)
yaw = normalize_yaw(yaw + 180)
return yaw
}
function rotate_angle(cx, cy, deg, distance)
{
var viewAngles = Local.GetViewAngles()
deg = degtorad( deg - viewAngles[1] )
var x = Math.sin( deg ) * distance
var y = Math.cos( deg ) * distance
x = cx - x
y = cy - y
return [ x, y ]
}
function drawArrow(angle) {
const pulse = Clamp((Math.floor(Math.sin(Globals.Realtime() * 5) * 127) + 128) + 20, 20, 255)
var distance = 200
var size = 45
var color = UI.GetColor(ui_color)
var new_point = rotate_angle(center_screen[0], center_screen[1], angle, distance)
var top = rotate_angle(new_point[0], new_point[1], angle, size)
var left = rotate_angle( new_point[0], new_point[1], angle + (size/2), size/2)
var right = rotate_angle( new_point[0], new_point[1], angle - (size/2), size/2)
Render.Polygon([top, right, left], [color[0], color[1], color[2], pulse]);
}
function g_paint_handler() {
var local = Entity.GetLocalPlayer()
var f = {
small: Render.GetFont("font.ttf", 16, false),
normal: Render.GetFont("Verdana.ttf", 10, true),
bold: Render.GetFont("Tahomabd.ttf", 10, true),
icon: Render.GetFont("undefeated.ttf", 24, true)
}
if (grenades == undefined || grenades.length == 0)
return;
var t = Globals.Frametime() * 255;
for (var i in grenades) {
var g = grenades[i]
if (g.active != undefined && !g.active)
continue;
if (g == temp_nade)
var color = [255, 0, 0, 255]
else
var color = UI.GetColor(ui_color)
var weapon = Entity.GetProp(Entity.GetWeapon(Entity.GetLocalPlayer()), "CBaseAttributableItem", "m_iItemDefinitionIndex");
switch (weapon) {
case 46:
case 48:
weapon = "weapon_molotov";
break;
case 44:
weapon = "weapon_hegrenade";
break;
case 45:
weapon = "weapon_smokegrenade";
break;
default:
weapon = "weapon_unknown";
break;
}
if (g.weapon == "weapon_hegrenade" && !(UI.GetValue(ui_active) & (1 << 0)))
continue;
if (g.weapon == "weapon_molotov" && !(UI.GetValue(ui_active) & (1 << 1)))
continue;
var pos = 0;
pos = [g.position[0], g.position[1], g.position[2] - 63];
var scr = Render.WorldToScreen(pos)
var dist = vector.distance(pos, Entity.GetRenderOrigin(local))
var width = Render.TextSize(g.name[0], f.normal)[0]
if (g.alpha == undefined) {
g.alpha = 0;
g.alpha_2 = 0;
g.width = 0;
g.divider = 1;
g.visible = false;
}
if (dist <= 500 && g.weapon == weapon) {
g.width = Math.max(24, Math.min(width + 14, g.width + t));
}
else if (dist <= 1000 && g.weapon == weapon) {
if (g.width > 23)
g.width = Math.max(23, g.width - t);
else
g.width = 23;
}
else {
if (g.alpha < 1)
g.width = Math.max(0, g.width - t);
}
if (dist <= 500 && g.weapon == weapon) {
g.alpha = Math.min(255, g.alpha + t);
}
else if (dist <= 1000 && g.weapon == weapon) {
g.alpha = Math.min(150, g.alpha + t * 2);
}
else {
g.alpha = Math.max(0, g.alpha - t * 3);
}
if (!g.visible) {
if (UI.GetValue(ui_walls))
g.divider = Math.min(2.3, g.divider + t / 255 * 4);
else
g.divider = 255;
}
else {
if (UI.GetValue(ui_walls))
g.divider = Math.max(1, g.divider - t / 255 * 4);
else
g.divider = 1;
}
switch (g.weapon) {
case "weapon_molotov":
var icon = "l";
break;
default:
var icon = "j";
break;
}
if (g.width < 1)
continue;
if (scr[2] && g.width >= 1) {
if (g.width > 23) {
Render.Rect(scr[0] - Math.min(width / 2, g.width / 2) - 16, scr[1] - 30, 26 + Math.min(width + 8, g.width), 26, [17, 17, 17, Math.min(220 / g.divider, 220 * (g.width / width))]);
Render.FilledRect(scr[0] - Math.min(width / 2, g.width / 2) - 15, scr[1] - 29, 24 + Math.min(width + 8, g.width), 24, [17, 17, 17, Math.min(150 / g.divider, 150 * (g.width / width))]);
Render.String(scr[0] - Math.min(width / 2, g.width / 2) - 12, scr[1] - 30, 0, icon, [color[0], color[1], color[2], g.alpha / g.divider], f.icon)
Render.Line(scr[0] - Math.min(width / 2, g.width / 2) + 7, scr[1] - 25, scr[0] - Math.min(width / 2, g.width / 2) + 7, scr[1] - 10, [color[0], color[1], color[2], Math.min(220 / g.divider, 220 * (g.width / width))])
/*Render.String(scr[0] + 13, scr[1] - 4 - 20, 1, g.name[0], [0, 0, 0, Math.min(220 / g.divider, 220 * (g.width / width))], f.normal);
Render.String(scr[0] + 12, scr[1] - 5 - 20, 1, g.name[0], [color[0], color[1], color[2], Math.min(220 / g.divider, 220 * (g.width / width))], f.normal);*/
Render.String(scr[0] + 13, scr[1] - 4 - 20, 1, g.name[0], [0, 0, 0, Math.min((g.alpha / g.divider) * (g.width / (width + 12)), 220)], f.normal);
Render.String(scr[0] + 12, scr[1] - 5 - 20, 1, g.name[0], [color[0], color[1], color[2], Math.min((g.alpha / g.divider) * (g.width / (width + 12)), 220)], f.normal);
}
else {
Render.FilledRect(scr[0] - g.width - 1, scr[1] - 30, g.width, 26, [17, 17, 17, g.alpha / g.divider]);
Render.Rect(scr[0] - g.width - 1, scr[1] - 30, g.width, 26, [17, 17, 17, g.alpha / g.divider]);
Render.String(scr[0] - g.width + 2, scr[1] - 30, 0, icon, [color[0], color[1], color[2], g.alpha / g.divider], f.icon)
}
}
if (dist > 100 || g.weapon != weapon) {
g.alpha_2 = Math.max(g.alpha_2 - t / 255 * 4, 0);
}
else {
g.alpha_2 = Math.min(g.alpha_2 + t / 255 * 4, 1);
}
if (g.alpha_2 < 0.1)
continue;
scr = angle_vec(g.viewangles)
var world_pos = [g.position[0] + scr[0] * 400, g.position[1] + scr[1] * 400, g.position[2] + scr[2] * 400];
scr = Render.WorldToScreen(world_pos);
if (scr[2]) {
var to_width = Render.TextSize(g.name[1], f.bold)[0]
if (g.description != undefined && g.description != "") {
var desc_width = Render.TextSize(g.description.toUpperCase(), f.small)[0];
if (to_width < desc_width)
to_width = desc_width - 8;
}
Render.Rect(scr[0] - 13, scr[1] - 10, to_width + 37, 27, [17, 17, 17, 220* g.alpha_2])
Render.FilledRect(scr[0] - 12, scr[1] - 9, to_width + 35, 25, [17, 17, 17, 150* g.alpha_2])
var c_color = [200, 200, 0]
var scr_dist = vector2d.distance([Render.GetScreenSize()[0] / 2, Render.GetScreenSize()[1] / 2], scr);
g.scr_dist = scr_dist;
if (scr_dist > 300)
c_color = [150, 150, 150];
else if (!can_attack())
c_color = [200, 0, 0];
else if (dist < 2 || g == player.grenade)
c_color = [0, 200, 0];
Render.FilledCircle(scr[0] - 3, scr[1] + 3, 5, [0, 0, 0, 255 * g.alpha_2])
Render.FilledCircle(scr[0] - 3, scr[1] + 3, 3, c_color.concat(255 * g.alpha_2))
Render.Circle(scr[0] - 3, scr[1] + 3, 3, c_color.concat(230 * g.alpha_2))
Render.Circle(scr[0] - 3, scr[1] + 3, 4, c_color.concat(210 * g.alpha_2))
Render.Circle(scr[0] - 3, scr[1] + 3, 5, c_color.concat(190 * g.alpha_2))
Render.Line(scr[0] + 7, scr[1] - 5, scr[0] + 7, scr[1] + 12, [color[0], color[1], color[2], 220 * g.alpha_2])
var y_off = 0;
if (g.description != undefined && g.description != "") {
y_off = 5;
var x = scr[0] + 11;
var y = scr[1];
var text = g.description.toUpperCase();
Render.String(x-1, y-1, 0, text, [0, 0, 0, 200 * g.alpha_2], f.small)
Render.String(x+1, y-1, 0, text, [0, 0, 0, 200 * g.alpha_2], f.small)
Render.String(x-1, y+1, 0, text, [0, 0, 0, 200 * g.alpha_2], f.small)
Render.String(x+1, y+1, 0, text, [0, 0, 0, 200 * g.alpha_2], f.small)
Render.String(x, y-1, 0, text, [0, 0, 0, 200 * g.alpha_2], f.small)
Render.String(x+1, y, 0, text, [0, 0, 0, 200 * g.alpha_2], f.small)
Render.String(x-1, y, 0, text, [0, 0, 0, 200 * g.alpha_2], f.small)
Render.String(x, y+1, 0, text, [0, 0, 0, 200 * g.alpha_2], f.small)
Render.String(x, y, 0, text, [color[0], color[1], color[2], 200 * g.alpha_2], f.small)
}
Render.Line(scr[0] + 13, scr[1]+2 - y_off, scr[0] + 15, scr[1]+4- y_off, [0, 0, 0, 220 * g.alpha_2])
Render.Line(scr[0] + 15, scr[1]+4 - y_off, scr[0] + 13, scr[1]+6- y_off, [0, 0, 0, 220 * g.alpha_2])
Render.Line(scr[0] + 16, scr[1]+2 - y_off, scr[0] + 18, scr[1]+4- y_off, [0, 0, 0, 220 * g.alpha_2])
Render.Line(scr[0] + 18, scr[1]+4 - y_off, scr[0] + 16, scr[1]+6- y_off, [0, 0, 0, 220 * g.alpha_2])
Render.Line(scr[0] + 12, scr[1]+1 - y_off, scr[0] + 14, scr[1]+3- y_off, [color[0], color[1], color[2], 220 * g.alpha_2])
Render.Line(scr[0] + 14, scr[1]+3 - y_off, scr[0] + 12, scr[1]+5- y_off, [color[0], color[1], color[2], 220 * g.alpha_2])
Render.Line(scr[0] + 15, scr[1]+1 - y_off, scr[0] + 17, scr[1]+3- y_off, [color[0], color[1], color[2], 220 * g.alpha_2])
Render.Line(scr[0] + 17, scr[1]+3 - y_off, scr[0] + 15, scr[1]+5- y_off, [color[0], color[1], color[2], 220 * g.alpha_2])
Render.String(scr[0] + 20, scr[1] - 2 - y_off, 0, g.name[1], [0, 0, 0, 220 * g.alpha_2], f.bold);
Render.String(scr[0] + 19, scr[1] - 3 - y_off, 0, g.name[1], [color[0], color[1], color[2], 220 * g.alpha_2], f.bold);
}
else {
if (UI.GetValue(ui_arrows)) {
var local_origin = Local.GetCameraPosition();
var angles = calculate_yaw(local_origin, world_pos);
drawArrow(angles)
}
}
}
}
function fix_movement(angle, viewangles, movement) {
var a1, b1, c1;
if (viewangles[1] < 0x0) a1 = 360 + viewangles[1];
else a1 = viewangles[1];
if (angle[1] < 0x0) b1 = 360 + angle[1];
else b1 = angle[1];
if (b1 < a1) c1 = Math['abs'](b1 - a1);
else c1 = 360 - Math['abs'](a1 - b1);
return [Math['cos'](degtorad(c1)) * movement[0] + Math['cos'](degtorad(c1 + 90)) * movement[1], Math['sin'](degtorad(c1)) * movement[0] + Math['sin'](degtorad(c1 + 90)) * movement[1], 0];
}
Cheat.LongPrint = function (string) {
for (x = 0; x < string.length; x += 255) {
Cheat.Print(string.substring(x, x + 255))
}
}
function move(angle, forwardmove, sidemove) {
var viewangles = Local.GetViewAngles();
var movement = [forwardmove, sidemove, 0];
movement = fix_movement(angle, viewangles, movement);
UserCMD.SetMovement(movement);
UserCMD.SetViewAngles(angle, true);
}
function move_to_point(position, g, some_bool) {
player.grenade = g;
var local = Entity.GetLocalPlayer();
var origin = Entity.GetRenderOrigin(local);
origin[2] = Entity.GetEyePosition(local)[2];
var distance = vector.subtract(position, origin)
var yaw = Local.GetViewAngles()[1];
var movement = [];
movement[0] = (Math.sin(yaw / 180 * Math.PI) * distance[1] + Math.cos(yaw / 180 * Math.PI) * distance[0]) * 10;
movement[1] = (Math.sin(yaw / 180 * Math.PI) * distance[0] + Math.cos(yaw / 180 * Math.PI) * -distance[1]) * 10;
movement[2] = 0;
var some_var = vector.length(distance);
var velocity = Entity.GetProp(local, "CCSPlayer", "m_vecVelocity[0]");
velocity = vector.length(velocity);
UserCMD.SetMovement(movement);
return some_var < (some_bool ? some_bool : 2) && (velocity < 2 || some_bool);;
}
var player = {
attacked: false,
running: false,
input: false,
start: 0,
next_ang: [],
throw_tick: 0,
moved: false,
did_jump: false,
run_start: 0,
grenade: 0,
recovering: false,
end_move: false,
recover_start: 0,
recover_jump: 0,
move_stopped: -1,
}
function g_move_handler() {
if (grenades == undefined || grenades.length == 0)
return;
var local = Entity.GetLocalPlayer()
for (var i in grenades) {
var g = grenades[i]
if (g.active != undefined && !g.active)
continue;
var pos = [g.position[0], g.position[1], g.position[2] - 63];
var dist = vector.distance(pos, Entity.GetRenderOrigin(local))
if (dist <= 1000) {
var is_visible = Trace.Line(local, Local.GetCameraPosition(), pos)[1]
g.visible = is_visible == 1;
}
}
if (!UI.GetValue(ui_key) || grenades.length == 0 || player.move_stopped == 0) {
if (player.grenade != 0) {
Cheat.ExecuteCommand("-forward")
Cheat.ExecuteCommand("-back")
Cheat.ExecuteCommand("-moveleft")
Cheat.ExecuteCommand("-moveright")
Cheat.ExecuteCommand("-speed")
Cheat.ExecuteCommand("-jump")
}
player = {
attacked: false,
running: false,
input: false,
start: 0,
next_ang: [],
throw_tick: 0,
moved: false,
did_jump: false,
run_start: 0,
grenade: 0,
recovering: false,
recover_start: 0,
recover_jump: 0,
move_stopped: -1,
}
return;
}
var weapon = Entity.GetProp(Entity.GetWeapon(Entity.GetLocalPlayer()), "CBaseAttributableItem", "m_iItemDefinitionIndex");
switch (weapon) {
case 46:
case 48:
weapon = "weapon_molotov";
break;
case 44:
weapon = "weapon_hegrenade";
break;
case 45:
weapon = "weapon_smokegrenade";
break;
default:
weapon = "weapon_unknown";
break;
}
var grens = grenades.filter(function(elem, index, array) {
if (elem.weapon == weapon)
return true;
else
return false;
});
var g = grens.sort(function(a, b) {
var value = vector.distance(Entity.GetRenderOrigin(Entity.GetLocalPlayer()), a.position) - vector.distance(Entity.GetRenderOrigin(Entity.GetLocalPlayer()), b.position);
if (value < 50) {
var a_scr = angle_vec(a.viewangles)
a_scr = Render.WorldToScreen([a.position[0] + a_scr[0] * 400, a.position[1] + a_scr[1] * 400, a.position[2] + a_scr[2] * 400]);
var a_dist = vector2d.distance([Render.GetScreenSize()[0] / 2, Render.GetScreenSize()[1] / 2], a_scr);
var b_scr = angle_vec(b.viewangles)
b_scr = Render.WorldToScreen([b.position[0] + b_scr[0] * 400, b.position[1] + b_scr[1] * 400, b.position[2] + b_scr[2] * 400]);
var b_dist = vector2d.distance([Render.GetScreenSize()[0] / 2, Render.GetScreenSize()[1] / 2], b_scr);
return a_dist - b_dist;
}
return value;
})[0];
if (player.grenade != 0)
g = player.grenade;
if (player.input || player.throw_tick + 9 > Globals.Tickcount()) {
if (g.grenade != undefined && g.grenade.recover != undefined && player.recovering == 0) {
player.recovering = Globals.Tickcount() + 8
}
UserCMD.Send();
UserCMD.SetViewAngles(player.next_ang.concat(0), true);
Cheat.ExecuteCommand("-attack")
Cheat.ExecuteCommand("-attack2")
player.input = false;
if (player.throw_tick == 0)
player.throw_tick = Globals.Tickcount();
return;
}
if (player.next_ang.length) {
UserCMD.SetViewAngles(player.next_ang.concat(0), true);
player.next_ang = [];
}
if (g === undefined || g.position === undefined)
return;
var dist = vector.distance(Entity.GetRenderOrigin(local), g.position);
scr = angle_vec(g.viewangles)
scr = Render.WorldToScreen([g.position[0] + scr[0] * 400, g.position[1] + scr[1] * 400, g.position[2] + scr[2] * 400]);
if ((dist > 120 || g.scr_dist > 300) && !player.input && player.grenade == 0) {
return;
}
var is_moved = (g.weapon == weapon && !player.attacked && player.recovering == 0 && can_attack() && !player.running) ? move_to_point(g.position, g) : false;
if (player.recovering != 0 && player.recovering < Globals.Tickcount())
is_moved = true;
if (g.grenade != undefined) {
if (g.grenade.run != undefined)
g.grenade.run.duration *= (Globals.Tickrate() / 64)
if (g.grenade.delay != undefined)
g.grenade.delay *= (Globals.Tickrate() / 64)
}
if (is_moved || player.start != 0) {
if (player.start == 0)
player.start = Globals.Tickcount();
if (g.weapon == weapon) {
if (g.grenade != undefined && g.grenade.run != undefined && g.grenade.run.duration > 0 && (player.recovering == 0 || player.recovering > Globals.Tickcount())) {
if (player.run_start + g.grenade.run.duration > Globals.Tickcount() || player.run_start == 0) {
player.running = true;
player.start = Number.MAX_SAFE_INTEGER;
if (player.run_start == 0)
player.run_start = Globals.Tickcount();
var moves = [0, 0]
//UserCMD.SetViewAngles(g.viewangles.concat(0), true);
switch (g.grenade.run.direction) {
case DIR.forward:
moves = [450, 0]
Cheat.ExecuteCommand("+forward")
break;
case DIR.back:
moves = [-450, 0]
Cheat.ExecuteCommand("+back")
break;
case DIR.left:
moves = [0, -450]
Cheat.ExecuteCommand("+moveleft")
break;
case DIR.right:
moves = [0, 450]
Cheat.ExecuteCommand("+moveright")
break;
}
if (g.grenade.run.walk)
UserCMD.SetButtons(UserCMD.GetButtons() | (1 << 17))
move(g.viewangles, moves[0], moves[1])
}
else if (g.grenade != undefined && (player.recovering == 0 || player.recovering > Globals.Tickcount()) && player.run_start + g.grenade.run.duration + 4 > Globals.Tickcount()) {
if (player.running)
player.start = Globals.Tickcount();
player.running = false;
var moves = [0, 0]
//UserCMD.SetViewAngles(g.viewangles.concat(0), true);
switch (g.grenade.run.direction) {
case DIR.forward:
Cheat.ExecuteCommand("+forward")
break;
case DIR.back:
Cheat.ExecuteCommand("+back")
break;
case DIR.left:
Cheat.ExecuteCommand("+moveleft")
break;
case DIR.right:
Cheat.ExecuteCommand("+moveright")
break;
}
if (g.grenade.run.walk)
UserCMD.SetButtons(UserCMD.GetButtons() | (1 << 17))
move(g.viewangles, moves[0], moves[1])
player.move_stopped = 1;
}
else if (player.move_stopped == 1 && (g.grenade == undefined || g.grenade.recover == undefined))
player.move_stopped = 0;
}
if (g.grenade != undefined && g.grenade.jump && !player.running && !player.did_jump) {
player.did_jump = true;
UserCMD.SetButtons(UserCMD.GetButtons() | (1 << 1));
if (g.grenade.run == undefined)
Cheat.ExecuteCommand("+speed")
}
if (!player.attacked) {
if (g.grenade != undefined && g.grenade.strength != undefined) {
if (g.grenade.strength == STRENGTH.high)
Cheat.ExecuteCommand("+attack")
//UserCMD.SetButtons(UserCMD.GetButtons() | (1 << 0))
if (g.grenade.strength == STRENGTH.mid) {
//UserCMD.SetButtons(UserCMD.GetButtons() | (1 << 0) | (1 << 11))
Cheat.ExecuteCommand("+attack")
Cheat.ExecuteCommand("+attack2")
}
if (g.grenade.strength == STRENGTH.low)
Cheat.ExecuteCommand("+attack2")
//UserCMD.SetButtons(UserCMD.GetButtons() | (1 << 11))
}
else
Cheat.ExecuteCommand("+attack")
//UserCMD.SetButtons(UserCMD.GetButtons() | (1 << 0))
UserCMD.Send();
}
if (player.start <= Globals.Tickcount()) {
if (player.start + (g.grenade != undefined && g.grenade.delay != undefined ? g.grenade.delay : 0) <= Globals.Tickcount()) {
player.attacked = true;
player.input = true;
player.next_ang = g.viewangles;
player.recover_start = 0;
UserCMD.Send();
}
}
}
if (g.grenade != undefined && g.grenade.recover != undefined && player.recovering != 0 && player.recovering < Globals.Tickcount()) {
if ((player.recover_start == 0 || player.recover_start + g.grenade.run.duration * (g.grenade.jump ? 1 : 2) > Globals.Tickcount())) {
player.running = true;
player.start = Number.MAX_SAFE_INTEGER;
if (player.recover_start == 0)
player.recover_start = Globals.Tickcount();
Cheat.ExecuteCommand("-forward")
Cheat.ExecuteCommand("-back")
Cheat.ExecuteCommand("-moveleft")
Cheat.ExecuteCommand("-moveright")
switch (g.grenade.recover.direction) {
case DIR.forward:
Cheat.ExecuteCommand("+forward")
break;
case DIR.back:
Cheat.ExecuteCommand("+back")
break;
case DIR.left:
Cheat.ExecuteCommand("+moveleft")
break;
case DIR.right:
Cheat.ExecuteCommand("+moveright")
break;
}
if (g.grenade.jump && player.recover_jump < 12) {
player.recover_jump++;
Cheat.ExecuteCommand("+jump")
}
else {
Cheat.ExecuteCommand("-jump")
}
if (g.grenade.recover.walk)
UserCMD.SetButtons(UserCMD.GetButtons() | (1 << 17))
//move(g.viewangles, moves[0], moves[1])
}
else {
player.move_stopped = 0;
}
}
}
else {
player = {
running: false,
input: false,
start: 0,
next_ang: [],
throw_tick: 0,
moved: false,
did_jump: false,
run_start: 0,
grenade: 0,
recovering: false,
recover_start: 0,
recover_jump: 0,
move_stopped: -1,
}
}
}
Cheat.RegisterCallback("CreateMove", "g_move_handler")
Cheat.RegisterCallback("Draw", "g_paint_handler")
var last_update = Globals.Curtime()
var setup_active = UI.AddCheckbox(path, "Setup grenade");
var setup_export = UI.AddCheckbox(path, "Export grenade");
UI.AddTextbox(path, "From")
var grenade_from = path.concat("From")
UI.AddTextbox(path, "To")
var grenade_to = path.concat("To")
UI.AddTextbox(path, "Description")
var grenade_desc = path.concat("Description")
UI.AddDropdown(path, "Weapon", ["weapon_molotov", "weapon_hegrenade"], 0)
var grenade_weapon = path.concat("Weapon")
var extended_settings = UI.AddMultiDropdown(path, "Extended settings", ["Jump", "Run", "Walk", "Recovery", "Delay", "Strength"])
UI.AddDropdown(path, "Run direction", ["Forward", "Left", "Right", "Back"], 0)
var run_direction = path.concat("Run direction");
UI.AddSliderInt(path, "Run duration", 0, 256)
var run_duration = path.concat("Run duration");
UI.AddDropdown(path, "Recovery direction", ["Forward", "Left", "Right", "Back"], 0)
var recovery_direction = path.concat("Recovery direction");
UI.AddSliderInt(path, "Delay", 0, 64)
var grenade_delay = path.concat("Delay");
UI.AddDropdown(path, "Strength", ["High", "Medium", "Low"], 0)
var grenade_strength = path.concat("Strength");
var temp_nade;
function ui_handler() {
if (last_update + 0.2 > Globals.Curtime())
return;
var settings = UI.GetValue(extended_settings);
if (UI.GetValue(ui_setup)) {
var g = {};
g.type = "grenade";
g.name = [];
g.name[0] = UI.GetString(grenade_from);
g.name[1] = UI.GetString(grenade_to);
if (UI.GetString(grenade_desc) != "")
g.description = UI.GetString(grenade_desc);
switch (UI.GetValue(grenade_weapon)) {
case 0:
g.weapon = "weapon_molotov";
break;
case 1:
g.weapon = "weapon_hegrenade";
break;
}
g.position = Entity.GetRenderOrigin(Entity.GetLocalPlayer())
g.position[2] += 63;
g.viewangles = [Local.GetViewAngles()[0], Local.GetViewAngles()[1]];
if (settings & (1 << 0)) {
if (g.grenade == undefined)
g.grenade = new Object()
g.grenade.jump = true;
}
if (settings & (1 << 1)) {
if (g.grenade == undefined)
g.grenade = new Object()
if (g.grenade.run == undefined)
g.grenade.run = new Object()
g.grenade.run.direction = UI.GetValue(run_direction)
g.grenade.run.duration = UI.GetValue(run_duration)
}
if (settings & (1 << 2)) {
if (g.grenade == undefined)
g.grenade = new Object()
if (g.grenade.run == undefined)
g.grenade.run = new Object()
g.grenade.run.walk = true;
}
if (settings & (1 << 3)) {
if (g.grenade == undefined)
g.grenade = new Object()
if (g.grenade.recover == undefined)
g.grenade.recover = new Object()
g.grenade.recover.direction = UI.GetValue(recovery_direction)
}
if (settings & (1 << 4)) {
if (g.grenade == undefined)
g.grenade = new Object()
g.grenade.delay = UI.GetValue(grenade_delay)
}
if (settings & (1 << 5)) {
if (g.grenade == undefined)
g.grenade = new Object()
g.grenade.strength = UI.GetValue(grenade_strength)
}
if (temp_nade != undefined)
grenades.splice(grenades.indexOf(temp_nade), 1);
grenades.push(g);
temp_nade = g;
}
if (UI.GetValue(setup_export)) {
UI.SetValue(setup_export, 0);
temp_nade.alpha = undefined;
temp_nade.alpha_2 = undefined;
temp_nade.width = undefined;
temp_nade.divider = undefined;
temp_nade.visible = undefined;
temp_nade.scr_dist = undefined
Cheat.PrintColor([89, 119, 239, 255], "\n---------------GRENADE LOCATION START---------------\n")
Cheat.LongPrint(JSON.stringify(temp_nade, null, '\t')+",");
Cheat.PrintColor([89, 119, 239, 255], "\n----------------GRENADE LOCATION END----------------\n")
}
last_update = Globals.Curtime()
if (UI.GetValue(setup_active)) {
UI.SetEnabled(grenade_from, 1)
UI.SetEnabled(grenade_to, 1)
UI.SetEnabled(grenade_desc, 1)
UI.SetEnabled(grenade_weapon, 1)
UI.SetEnabled(extended_settings, 1)
if (settings & (1 << 1)) {
UI.SetEnabled(run_direction, 1)
UI.SetEnabled(run_duration, 1)
}
else {
UI.SetEnabled(run_direction, 0)
UI.SetEnabled(run_duration, 0)
}
if (settings & (1 << 3)) {
UI.SetEnabled(recovery_direction, 1)
}
else {
UI.SetEnabled(recovery_direction, 0)
}
if (settings & (1 << 4)) {
UI.SetEnabled(grenade_delay, 1)
UI.SetEnabled(grenade_delay, 1)
}
else {
UI.SetEnabled(grenade_delay, 0)
UI.SetEnabled(grenade_delay, 0)
}
if (settings & (1 << 5)) {
UI.SetEnabled(grenade_strength, 1)
UI.SetEnabled(grenade_strength, 1)
}
else {
UI.SetEnabled(grenade_strength, 0)
UI.SetEnabled(grenade_strength, 0)
}
}
else {
UI.SetEnabled(grenade_from, 0)
UI.SetEnabled(grenade_to, 0)
UI.SetEnabled(grenade_desc, 0)
UI.SetEnabled(grenade_weapon, 0)
UI.SetEnabled(extended_settings, 0)
UI.SetEnabled(run_direction, 0)
UI.SetEnabled(run_duration, 0)
UI.SetEnabled(recovery_direction, 0)
UI.SetEnabled(grenade_delay, 0)
UI.SetEnabled(grenade_delay, 0)
UI.SetEnabled(grenade_strength, 0)
UI.SetEnabled(grenade_strength, 0)
}
}
Cheat.RegisterCallback("Draw", "ui_handler")
function switch_team() {
grenades = locations[World.GetMapName()]
}
Cheat.RegisterCallback("switch_team", "switch_team")