До конца не тестил но вроде все ворк нормально
код мб кринжак но воркает
код мб кринжак но воркает
C++:
local screen = EngineClient.GetScreenSize()
local font = Render.InitFont("Verdana", 12,{'r'})
local memory = {}
local enabled = Menu.SwitchColor("Main", "Enabled", false, Color.new(0, 0, 0))
local first_color = Menu.ColorEdit("Main", "First color", Color.new(1, 0, 0))
local second_color = Menu.ColorEdit("Main", "Second color", Color.new(0, 1, 0))
local third_color = Menu.ColorEdit("Main", "Third color", Color.new(0, 0, 1 ))
local spec = {
x = Menu.SliderInt("Main", "Spectators x", 300, 0, screen.x),
y = Menu.SliderInt("Main", "Spectators y", 400, 0, screen.y)
}
spec.x:SetVisible(false)
spec.y:SetVisible(false)
Menu.Button("Main", "Reset position",function()
spec.x:Set(300)
spec.y:Set(400)
end)
function move(x,y,w,h,sldx,sldy)
local mp = Cheat.GetMousePos()
if Cheat.IsKeyDown(0x01) then
if mp.x > x and mp.x < x+w and mp.y > y and mp.y < y+h then
if drg == 0 then
drg = 1
memory[0] = x-mp.x
memory[1] = y-mp.y
end
end
else
drg = 0
end
if drg == 1 then
sldx:Set(mp.x + memory[0])
sldy:Set(mp.y + memory[1])
end
end
function get_spectators(player)
local spectats = {}
local players = EntityList.GetPlayers()
for player_index, player_entity in pairs(players) do
if (player_entity:IsDormant() == false) then
local spectateMode = player_entity:GetProp("m_iObserverMode")
local spectatePlayer = player_entity:GetProp("m_hObserverTarget")
if spectatePlayer then
if spectateMode ~= 6 then
local spectatingEntity = EntityList.GetClientEntityFromHandle(spectatePlayer)
if spectatingEntity ~= nil and (spectatingEntity:EntIndex() == player:EntIndex() or spectatingEntity:EntIndex() == EntityList.GetClientEntityFromHandle(player:GetProp("m_hObserverTarget")):EntIndex()) then
table.insert(spectats, {
name = string.len(player_entity:GetName()) > 16 and string.sub(player_entity:GetName(), 0, 16) .. "..." or player_entity:GetName(),
})
end
end
end
end
end
return spectats
end
Cheat.RegisterCallback("draw", function()
if not enabled:Get() then return end
local specx,specy = spec.x:Get(),spec.y:Get()
local lc = EntityList.GetLocalPlayer()
if lc ~= nil then
specs = get_spectators(lc)
else
specs = {}
end
local specs = get_spectators(lc)
for k,v in pairs(specs) do
Render.Text(v.name, Vector2.new(specx, specy+22+((k-1)*13)),Color.new(1,1,1), 12,font)
end
if #specs ~= 0 or Cheat.IsMenuVisible() then
Render.BoxFilled(Vector2.new( specx, specy+2),Vector2.new( specx+120, specy+22), enabled:GetColor())
Render.GradientBoxFilled(Vector2.new(specx, specy),Vector2.new( specx+120/2, specy+2), first_color:GetColor(), second_color:GetColor(), first_color:GetColor(), second_color:GetColor())
Render.GradientBoxFilled(Vector2.new( specx+120/2, specy),Vector2.new( specx+120, specy+2), second_color:GetColor(), third_color:GetColor(), second_color:GetColor(), third_color:GetColor())
Render.Text("Spectator list", Vector2.new(specx+120/5, specy+5),Color.new(1,1,1), 12,font)
move(specx,specy,120,22,spec.x,spec.y)
end
end)
Последнее редактирование: