UX/UI дизайнер
-
Автор темы
- #1
Простой индикатор даблтапа для нла
Код не претендует на звание ахуеть какого гениального, скрипт создан для самых новичков в луа скриптинге
Тема на нл маркете
Видеообзор
Код не претендует на звание ахуеть какого гениального, скрипт создан для самых новичков в луа скриптинге
JavaScript:
-- Main varuables
local screensize = EngineClient.GetScreenSize();
local frametime = GlobalVars.frametime;
local doubletap = Menu.FindVar("Aimbot", "Ragebot", "Exploits", "Double Tap");
local renderblur = Render.Blur;
local renderbox = Render.BoxFilled;
local renderweap = Render.WeaponIcon;
local caltextsize = Render.CalcTextSize;
local caltweapsize = Render.CalcWeaponIconSize;
local rendertext = Render.Text;
local renderloadimg = Render.LoadImage;
local renderimg = Render.Image;
local in_game = EngineClient.IsInGame();
local drop_bytes = Http.Get("https://i.imgur.com/8qf3SpE.png");
local bullet_bytes = Http.Get("https://i.imgur.com/45G9qyg.png");
local bullet_icon = renderloadimg(bullet_bytes, Vector2.new(32, 32));
local drop_icon = renderloadimg(drop_bytes, Vector2.new(24, 24));
-- Animation function
local anim =
{
clamp = function(v, min, max)
return ((v > max) and max) or ((v < min) and min or v);
end,
alpha = 0,
alpha1 = 0;
}
-- Menu items in array for convenient use in the future
local menu_items =
{
enable = Menu.Switch("Main", "Enable", false);
theme = Menu.Combo("Main", "Theme", {"Dark blue", "Dark", "Light"}, 0, "Indicator theme");
recharge = Menu.ColorEdit("Main", "Recharge color", Color.new(1.0, 1.0, 1.0, 1.0), "Color of DT recharge indicator");
x_slider = Menu.SliderFloat("Main", "X position", 50.0, 0, screensize.x, "Set X position for indicator");
y_slider = Menu.SliderFloat("Main", "Y position", 50.0, 0, screensize.y, "Set Y position for indicator");
font = Render.InitFont("Verdana", 12, {"b"});
}
-- Is live check
local alive =
{
windowsize = function(varuable, old, new)
local player = EntityList.GetLocalPlayer();
if player == nil then return end;
if player:GetProp('m_iHealth') > 0 then
varuable = old;
elseif player:GetProp('m_iHealth') == 0 then
varuable = new;
end
return varuable;
end,
check = function()
local player = EntityList.GetLocalPlayer();
if player == nil then return end;
if player:GetProp('m_iHealth') > 0 then
bool = true;
elseif player:GetProp('m_iHealth') == 0 then
bool = false;
end
return bool;
end
}
-- Draggable function
local drag = false;
local memory = {x, y};
local drag_window = function(x, y, w, h, val1, val2)
local key_pressed = Cheat.IsKeyDown(0x01);
local menu_visible = Cheat.IsMenuVisible();
local mouse_pos = Cheat.GetMousePos();
if mouse_pos.x >= x and mouse_pos.x <= x + w and mouse_pos.y >= y and mouse_pos.y <= y + h then
if key_pressed and drag == false then
drag = true;
memory.x = x - mouse_pos.x;
memory.y = y - mouse_pos.y;
end
end
if not key_pressed then
drag = false;
end
if drag == true and menu_visible then
val1:SetFloat(mouse_pos.x + memory.x);
val2:SetFloat(mouse_pos.y + memory.y);
end
end
-- Main function
local g_paint = function()
-- Animation (shit code part)
local anim_time = frametime * 1500;
local menu_visible = Cheat.IsMenuVisible();
if menu_items.enable:GetBool() then
if alive.check() == true then
anim.alpha1 = anim.clamp(anim.alpha1 + anim_time, 0, 200);
anim.alpha = anim.clamp(anim.alpha + anim_time, 0, 255);
else
if menu_visible then
anim.alpha1 = anim.clamp(anim.alpha1 + anim_time, 0, 200);
anim.alpha = anim.clamp(anim.alpha + anim_time, 0, 255);
else
anim.alpha1 = anim.clamp(anim.alpha1 - anim_time, 0, 200);
anim.alpha = anim.clamp(anim.alpha - anim_time, 0, 255);
end
end
elseif not menu_items.enable:GetBool() then
anim.alpha1 = anim.clamp(anim.alpha1 - anim_time, 0, 200);
anim.alpha = anim.clamp(anim.alpha - anim_time, 0, 255);
end
-- Colors of the themes
local theme =
{
darkblue = Color.new(10/255, 18/255, 29/255, anim.alpha1/255),
dark = Color.new(28/255, 26/255, 26/255, anim.alpha1/255),
white = Color.new(255/255, 255/255, 255/255, anim.alpha1/255),
light = Color.new(255/255, 255/255, 255/255, anim.alpha/255),
active = Color.new(255/255, 255/255, 255/255, 255/255),
nonactive = Color.new(255/255, 255/255, 255/255, anim.alpha1/255),
icon = Color.new(53.0/255, 177.0/255, 235.0/255, anim.alpha/255),
line = Color.new(80/255, 80/255, 80/255, anim.alpha1/255),
linedb = Color.new(100/255, 100/255, 110/255, anim.alpha1/255),
whitetext = Color.new(255/255, 255/255, 255/255, anim.alpha/255),
darktext = Color.new(0/255, 0/255, 0/255, anim.alpha/255),
}
-- Rendering body of the indicator
local x = menu_items.x_slider:GetFloat();
local y = menu_items.y_slider:GetFloat();
local blur_height = alive.windowsize(blur_height, 52, 35);
if menu_items.theme:GetInt() == 0 then
renderblur(Vector2.new(x, y), Vector2.new(x+150, y+blur_height), theme.light, 3.0);
renderbox(Vector2.new(x, y), Vector2.new(x+150, y+23), theme.darkblue, 3.0);
rendertext("Double tap", Vector2.new(x+21, y+5), theme.whitetext, 12);
elseif menu_items.theme:GetInt() == 1 then
renderblur(Vector2.new(x, y), Vector2.new(x+150, y+blur_height), theme.light, 3.0);
renderbox(Vector2.new(x, y), Vector2.new(x+150, y+23), theme.dark, 3.0);
rendertext("Double tap", Vector2.new(x+21, y+5), theme.whitetext, 12);
else
renderblur(Vector2.new(x, y), Vector2.new(x+150, y+blur_height), theme.light, 3.0);
renderbox(Vector2.new(x, y), Vector2.new(x+150, y+23), theme.white, 3.0);
rendertext("Double tap", Vector2.new(x+21, y+5), theme.darktext, 12);
end
-- Charge indicator
local charge = Exploits.GetCharge();
local charge_clr = menu_items.recharge:GetColor()
local line_size = 0;
if not doubletap:GetBool() then
line_size = 150;
else
line_size = charge*150;
end
renderbox(Vector2.new(x, y+21), Vector2.new(x+line_size, y+23), Color.new(charge_clr.r, charge_clr.g, charge_clr.b, anim.alpha/255));
renderimg(drop_icon, Vector2.new(x+2, y+4), Vector2.new(14, 14), theme.icon);
drag_window(x, y, x+150, y+blur_height, menu_items.x_slider, menu_items.y_slider);
-- If player isn't in a game, script won't work
if in_game == false then return end;
local player_ent = EntityList.GetClientEntity(EngineClient.GetLocalPlayer());
local player = player_ent:GetPlayer();
local weap_active = player:GetActiveWeapon();
-- If local player haven't weapon, script won't work
if weap_active == nil then return end;
local weap_id = weap_active:GetWeaponID();
local attack = weap_active:GetProp("DT_BaseCombatWeapon", "m_flNextPrimaryAttack"); -- https://raw.githubusercontent.com/necuk/csgo-netvars/master/NetVar-Dumps/13491.txt
local shoot = false;
-- If local player is shooting, varuable "shoot" will be equal true
local curtime = GlobalVars.curtime;
if attack <= curtime then shoot = true end;
-- If switcher not enable, script won't work
if not menu_items.enable:GetBool() then return end;
-- Check if current weapon is not DTable (shit code part)
local shotguns = false;
if weap_id == 35 or weap_id == 25 or weap_id == 27 or weap_id == 29 then
shotguns = true;
end
-- Render weapon icon
if doubletap:GetBool() and shotguns == false then
if shoot == true then
if charge >= 1 then
renderweap(weap_id, Vector2.new(x+5, y+29), theme.active, 16);
else
renderweap(weap_id, Vector2.new(x+5, y+29), theme.nonactive, 16);
end
else
renderweap(weap_id, Vector2.new(x+5, y+29), theme.nonactive, 16);
end
else
renderweap(weap_id, Vector2.new(x+5, y+29), theme.nonactive, 16);
end
-- Render icons
local weapic_size = caltweapsize(weap_id, 16);
if not weap_active:IsGrenade() and not weap_active:IsKnife() then
if shoot == true then
if doubletap:GetBool() and shotguns == false then
if charge >= 1 then
if weap_id == 38 or weap_id == 11 then
renderimg(bullet_icon, Vector2.new(x+130, y+29), Vector2.new(17, 17), theme.active);
renderimg(bullet_icon, Vector2.new(x+115, y+29), Vector2.new(17, 17), theme.active);
elseif weap_id == 40 or weap_id == 64 or weap_id == 9 then
renderimg(bullet_icon, Vector2.new(x+130, y+29), Vector2.new(17, 17), theme.active);
else
renderimg(bullet_icon, Vector2.new(x+130, y+29), Vector2.new(17, 17), theme.active);
renderimg(bullet_icon, Vector2.new(x+115, y+29), Vector2.new(17, 17), theme.active);
end
else
renderimg(bullet_icon, Vector2.new(x+130, y+29), Vector2.new(17, 17), theme.nonactive);
end
else
renderimg(bullet_icon, Vector2.new(x+130, y+29), Vector2.new(17, 17), theme.nonactive);
end
end
end
end
Cheat.RegisterCallback("draw", g_paint)
Видеообзор