GAMESENSE LUA Hysteria 2.1
- От Iska
- Counter-Strike: Global Offensive
- 50 Скачивания
- 0 ratings
Ласт хистерия мб кому нужна, поменяйте название с .txt на .lua и закиньте в папку с кс
Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
Easzy's Quadcopter | Customizable drone-- region init
local DamageIndicator = {}
DamageIndicator.__index = DamageIndicator
-- endregion
-- region constructor
function DamageIndicator:new()
local obj = setmetatable({}, DamageIndicator)
obj.master_switch = ui.new_checkbox("LUA", "B", "min_dmg_indicator")
obj.color_picker = ui.new_color_picker("LUA", "B", "min_dmg_indicator", 180, 180, 180, 230)
obj.references = {
min_damage = ui.reference("RAGE", "Aimbot", "Minimum damage"),
min_damage_override = { ui.reference("RAGE", "Aimbot", "Minimum damage override") }
}
obj.screen_size = { client.screen_size() }
obj.center_pos = {
obj.screen_size[1] / 2,
obj.screen_size[2] / 2
}
obj.text_pos = {
obj.center_pos[1],
obj.center_pos[2]
}
obj.drag_offset = { 0, 0 }
obj.animation = {
NULL = {
outline_width = 0,
line_alpha = 0
},
transition_speed = 10,
drag_limit = 56,
outline_target_width = 120,
line_target_alpha = 80,
text_alpha = 120
}
obj.lines = {
{
x = obj.center_pos[1],
y = obj.center_pos[2]
}
}
obj.WEAPON_IN_HANDLE = {
-- Pistols
["CWeaponGlock"] = true,
["CWeaponHKP2000"] = true,
["CWeaponUSP"] = true,
["CWeaponP250"] = true,
["CWeaponFiveSeven"] = true,
["CWeaponTec9"] = true,
["CWeaponElite"] = true,
["CWeaponCZ75A"] = true,
["CDEagle"] = true,
-- SMGs
["CWeaponMP9"] = true,
["CWeaponMP7"] = true,
["CWeaponMP5Navy"] = true,
["CWeaponUMP45"] = true,
["CWeaponP90"] = true,
["CWeaponBizon"] = true,
["CWeaponMac10"] = true,
-- Rifles
["CWeaponAK47"] = true,
["CWeaponM4A1"] = true,
["CWeaponM4A1_Silencer"] = true,
["CWeaponGalilAR"] = true,
["CWeaponFamas"] = true,
["CWeaponSSG08"] = true,
["CWeaponAUG"] = true,
["CWeaponSG556"] = true,
["CWeaponAWP"] = true,
["CWeaponG3SG1"] = true,
["CWeaponSCAR20"] = true,
-- Shotguns
["CWeaponNova"] = true,
["CWeaponXM1014"] = true,
["CWeaponSawedoff"] = true,
["CWeaponMag7"] = true,
-- Machine Guns
["CWeaponM249"] = true,
["CWeaponNegev"] = true,
-- Knife
["CKnife"] = false,
-- Grenades
["CFlashbang"] = false,
["CHEGrenade"] = false,
["CWeaponSmokeGrenade"] = false,
["CWeaponMolotov"] = false,
["CWeaponIncendiaryGrenade"] = false,
["CWeaponDecoy"] = false,
["CWeaponTaser"] = true,
-- Bomb
["CPlantedC4"] = false,
["CWeaponC4"] = false,
-- Other
["CWeaponBreachCharge"] = false,
["CWeaponTablet"] = false,
["CWeaponMelee"] = false,
["CWeaponShield"] = false
}
obj.current_damage = ui.get(obj.references.min_damage)
obj.is_dragging = false
ui.set_callback(obj.master_switch, function(self)
obj:toggle(ui.get(self))
end)
obj:toggle(ui.get(obj.master_switch))
return obj
end
-- endregion
-- region utility functions
function DamageIndicator:lerp(start, finish, t)
return start + (finish - start) * math.sin(t * math.pi / 2)
end
function DamageIndicator:toggle(enabled)
local callback_fn = enabled and client.set_event_callback or client.unset_event_callback
callback_fn("paint_ui", function(ctx) self:paint(ctx) end)
callback_fn("paint_ui", function() self:handle_mouse_input() end)
end
function DamageIndicator:is_mouse_in_circle_bounds(mouse_x, mouse_y)
local dx, dy = mouse_x - self.text_pos[1], mouse_y - self.text_pos[2]
return math.sqrt(dx * dx + dy * dy) <= 12
end
function DamageIndicator:snap_to_lines()
for _, line in ipairs(self.lines) do
if math.abs(self.text_pos[2] - line.y) < 6 then
self.text_pos[2] = line.y
end
if math.abs(self.text_pos[1] - line.x) < 6 then
self.text_pos[1] = line.x
end
end
end
function DamageIndicator:draw_outline_lines(x, y, width, height, r, g, b, alpha)
renderer.line(x + width / 2, y, x + width / 2, y + height, r, g, b, alpha)
renderer.line(x, y + height / 2, x + width, y + height / 2, r, g, b, alpha)
end
-- endregion
-- region paint
function DamageIndicator:paint(ctx)
local localplayer = entity.get_local_player()
if not localplayer or not entity.is_alive(localplayer) then
return
end
local weapon_entindex = entity.get_player_weapon(localplayer)
local weapon_classname = entity.get_classname(weapon_entindex)
local weapon_name = self.WEAPON_IN_HANDLE[weapon_classname]
local r, g, b, a = ui.get(self.color_picker)
local target_dmg
if ui.get(self.references.min_damage_override[2]) then
target_dmg = ui.get(self.references.min_damage_override[3])
self.animation.text_alpha = self:lerp(
self.animation.text_alpha,
weapon_name and a or 0,
globals.frametime() * self.animation.transition_speed
)
else
target_dmg = ui.get(self.references.min_damage)
self.animation.text_alpha = self:lerp(
self.animation.text_alpha,
weapon_name and 100 or 0,
globals.frametime() * self.animation.transition_speed
)
end
if not (self.animation.text_alpha > 0.09) then
return
end
self.current_damage = self:lerp(
self.current_damage,
weapon_name and target_dmg or 0,
globals.frametime() * self.animation.transition_speed
)
self.text_pos[1] = math.max(
self.center_pos[1] - self.animation.drag_limit,
math.min(self.center_pos[1] + self.animation.drag_limit,
self.text_pos[1])
)
self.text_pos[2] = math.max(
self.center_pos[2] - self.animation.drag_limit,
math.min(self.center_pos[2] + self.animation.drag_limit,
self.text_pos[2])
)
if ui.is_menu_open() then
self.animation.outline_target_width = 140
self.animation.line_target_alpha = 60
else
self.animation.outline_target_width = 0
self.animation.line_target_alpha = 0
end
-- region lerp
self.animation.NULL.outline_width = self:lerp(
self.animation.NULL.outline_width,
weapon_name and self.animation.outline_target_width or 0,
globals.frametime() * self.animation.transition_speed / 2
);
self.animation.NULL.line_alpha = self:lerp(
self.animation.NULL.line_alpha,
weapon_name and self.animation.line_target_alpha or 0,
globals.frametime() * self.animation.transition_speed / 2
)
-- endregion
local outline_x, outline_y = self.center_pos[1] - self.animation.NULL.outline_width / 2, self.center_pos[2] - self.animation.NULL.outline_width / 2
self:draw_outline_lines(
outline_x, outline_y,
self.animation.NULL.outline_width,
self.animation.NULL.outline_width,
r, g, b,
self.animation.NULL.line_alpha
)
if self.is_dragging then
self:snap_to_lines()
end
renderer.text(
self.text_pos[1],
self.text_pos[2],
r, g, b,
math.floor(self.animation.text_alpha),
"-rc", 0,
string.format("%.0f", self.current_damage)
)
end
-- endregion
-- region mouse input handling
function DamageIndicator:handle_mouse_input()
local mouse_x, mouse_y = ui.mouse_position()
if client.key_state(0x01) and not self.is_dragging and self:is_mouse_in_circle_bounds(mouse_x, mouse_y) then
self.is_dragging = true
self.drag_offset[1] = mouse_x - self.text_pos[1]
self.drag_offset[2] = mouse_y - self.text_pos[2]
end
if not client.key_state(0x01) then
self.is_dragging = false
end
if self.is_dragging then
self.text_pos[1] = mouse_x - self.drag_offset[1]
self.text_pos[2] = mouse_y - self.drag_offset[2]
end
end
-- endregion
-- region instance creation
local damage_indicator = DamageIndicator:new()
-- endregion