Есть ли у кого-то хороший скринграб меню, для бадминки
Где при анти-скринграбе пишется, что у игрока подделан скриншот.
Примерно как в сборке фаста, примерно как в этом коде-
Где при анти-скринграбе пишется, что у игрока подделан скриншот.
Примерно как в сборке фаста, примерно как в этом коде-
Lua:
local inFrame = false
local capturing = false
local stopScreenGrab = false
local screenshotFailed = false
local screenshotRequested = false
local screenshotRequestedLastFrame = false
local color = color or Color(240, 22, 22, 155)
local function UploadScreenGrab(data)
HTTP({
url = 'https://api.imgur.com/3/image',
method = 'post',
headers = {
['Authorization'] = 'Client-ID 5b236da1bc764ca'
},
success = function(_, body)
if screenshotFailed then
screenshotFailed = false
return
end
body = util.JSONToTable(body)
if istable(body) then
if not body.data.link and body.data.error then
net.Start('bScreenGrabFailed')
net.WriteString(body.data.error)
net.SendToServer()
return
end
net.Start('bScreenGrabSuccess')
net.WriteString(body.data.link)
net.SendToServer()
end
end,
failed = function()
net.Start('bScreenGrabFailed')
net.WriteString('Невозможно подключиться к Imgur!')
net.SendToServer()
end,
parameters = {
image = data
}
})
end
hook.Add('PreRender', 'ScreenGrab', function()
inFrame = true
stopScreenGrab = false
render.SetRenderTarget()
end)
local screengrabRT = GetRenderTarget('ScreengrabRT' .. ScrW() .. "_" .. ScrH(), ScrW(), ScrH())
hook.Add('PostRender', 'ScreenGrab', function(vOrigin, vAngle, vFOV)
if stopScreenGrab then return end
inFrame = false
if screenshotRequestedLastFrame then
render.PushRenderTarget(screengrabRT)
else
render.CopyRenderTargetToTexture(screengrabRT)
render.SetRenderTarget(screengrabRT)
end
if screenshotRequested or screenshotRequestedLastFrame then
screenshotRequested = false
if jit.version == 'LuaJIT 2.1.0-beta3' then
if screenshotRequestedLastFrame then
screenshotRequestedLastFrame = false
else
screenshotRequestedLastFrame = true
return
end
end
local randx, randy = math.random(0, ScrW()), math.random(0, ScrH())
local randw, randh = math.random(1, 5), math.random(1, 5)
surface.SetDrawColor(255, 0, 0)
surface.DrawRect(randx, randy, randw, randh)
cam.Start2D()
surface.SetFont('Trebuchet24')
local text = LocalPlayer():SteamID64()
local x, y = ScrW() * 0.5, ScrH() * 0.5
local w, h = surface.GetTextSize(text)
surface.SetDrawColor(0, 0, 0, 100)
surface.DrawRect(x - w * 0.5 - 5, y - h * 0.5 - 5, w + 10, h + 10)
surface.SetTextPos(math.ceil(x - w * 0.5), math.ceil(y - h * 0.5 ))
surface.SetTextColor(255, 23, 1)
surface.DrawText(text)
surface.SetDrawColor(255, 255, 255)
surface.DrawRect(0, 0, 1, 1)
cam.End2D()
capturing = true
local frame1 = FrameNumber()
local data = render.Capture({
format = 'jpeg',
quality = 60,
x = 0,
y = 0,
w = ScrW(),
h = ScrH()
})
local frame2 = FrameNumber()
capturing = false
if frame1 != frame2 then
net.Start('bScreenGrabFailed')
net.WriteString('Скриншот подделан, возможно читер! (Код: 3)')
net.SendToServer()
end
UploadScreenGrab(util.Base64Encode(data))
end
if screenshotRequestedLastFrame then
render.PopRenderTarget()
render.CopyRenderTargetToTexture(screengrabRT)
render.SetRenderTarget(screengrabRT)
end
end)
timer.Simple(.5, function()
hook.Add('PreDrawViewModel', 'ScreenGrab', function()
if capturing then
net.Start('bScreenGrabFailed')
net.WriteString('Скриншот подделан, возможно читер! (Код: 1)')
net.SendToServer()
end
end)
end)
net.Receive('bScreenGrabStart', function()
screenshotRequested = true
end)
net.Receive('bScreenGrabSuccess', function()
local url = net.ReadString()
local stm = net.ReadString()
local w, h = ScrW() * 0.9, ScrH() * 0.9
local fr = ui.Create('ui_frame', function(self)
self:SetSize(w, h)
self:SetTitle('Скриншот экрана - ' .. stm)
self:Center()
self:MakePopup()
end)
local html = ui.Create('HTML', function(self)
self:SetPos(5, 32)
self:SetSize(w - 10, h - 37)
self:SetHTML([[
<html>
<head>
<style>
body {
margin: 0;
overflow: hidden;
}
img {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<img src="]] .. url .. [[" />
</body>
</html>
]])
end, fr)
end)
hook.Add('ShutDown', 'bScreenGrabStop', function()
stopScreenGrab = true
render.SetRenderTarget()
end)
hook.Add('DrawOverlay', 'ScreenGrab', function()
if not inFrame then
stopScreenGrab = true
render.SetRenderTarget()
end
end)
net.Receive('bScreenGrabMenuReload', function()
local pl = LocalPlayer()
local size = net.ReadUInt(16)
pl.sg_tab = pon.decode(util.Decompress(net.ReadData(size)))
pl.bScreenGrabMenuReload = true
end)
net.Receive('bScreenGrabMenu', function()
if IsValid(fr) then fr:Remove() end
local pl = LocalPlayer()
local size = net.ReadUInt(16)
pl.sg_tab = pon.decode(util.Decompress(net.ReadData(size)))
local fr
local scrw, scrh = ScrW(), ScrH()
fr = ui.Create('ui_frame', function(self)
self:SetSize(scrw / 2, scrh / 2)
self:SetTitle('Скринграб меню')
self:Center()
self:MakePopup()
end)
local reload_button = ui.Create('DImageButton', function(self, p)
self:SetPos(fr:GetWide() - 69, fr:GetTall() / 110 + 2)
self:SetSize(18, 18)
self:SetImage('icon16/arrow_refresh.png')
self.DoClick = function(self)
net.Start('bScreenGrabMenuReload')
net.SendToServer()
pl:ChatPrint('Таблица обновлена!')
end
end, fr)
local pl_list = ui.Create('ui_playerrequest', function(self, p)
self:SetSize(p:GetWide() / 3.35, p:GetTall() - 35)
self:SetPos(1, 29)
self.OnSelection = function(self, row, targ)
if IsValid(targ) then
RunConsoleCommand('ba', 'sg', targ:SteamID())
else
pl:ChatPrint('Игрок вышел с сервера!')
end
end
end, fr)
local list = ui.Create('DListView', function(self, p)
self:SetSize(p:GetWide() - pl_list:GetWide() - 6, p:GetTall())
self:DockMargin(0, 0, 0, 32.5)
self:Dock(RIGHT)
self:SetPos(pl_list:GetWide() + 1, p:GetTall())
self:AddColumn('Время'):SetFixedWidth(80)
self:AddColumn('Ник и SteamID')
self:AddColumn('Url'):SetFixedWidth(185)
self:AddColumn('Варнинг'):SetFixedWidth(80)
self:SetHeaderHeight(25)
self:SetDataHeight(26)
end, fr)
local lbl = ui.Create('DLabel', function(self, p)
self:SetPos(pl_list:GetWide() + 3, p:GetTall() - 29)
self:SetZPos(10)
self:SetText('Поиск:')
end, fr)
local txt = ui.Create('DTextEntry', function(self, p)
self:SetSize(list:GetWide() - 60, 25)
self:SetPos(lbl:GetWide() + pl_list:GetWide() - 5, p:GetTall() - 30)
self:SetFont('ui.22')
end, fr)
list.OnRowSelected = function(parent, line)
local row = list:GetLine(line)
local log = row:GetColumnText(1) .. ' | ' .. row:GetColumnText(2)
local menu = ui.DermaMenu()
local color_green = Color(175, 255, 175)
local color_grey = Color(190, 190, 190)
local color_white = Color(255, 255, 255)
menu:AddOption('Скопировать строку', function()
SetClipboardText(log)
chat.AddText(color_white, 'Строка скопирована: ', color_green, row:GetColumnText(1), color_white, ' | ', color_green, row:GetColumnText(2), color_white, ' | ', color_grey, row:GetColumnText(3))
end)
for k, v in SortedPairs(row.Copy or {}) do
menu:AddOption('Скопировать ' .. k, function()
SetClipboardText(v)
chat.AddText(color_white, 'Скопировано: ', color_green, k, color_grey, ' (', v, ')')
end)
if k == 'Url' then
menu:AddOption('Открыть ' .. k, function()
local w, h = ScrW() * 0.9, ScrH() * 0.9
local fr = ui.Create('ui_frame', function(self)
self:SetSize(w, h)
self:SetTitle('Скриншот экрана - ' .. row:GetColumnText(2))
self:Center()
self:MakePopup()
end)
local html = ui.Create('HTML', function(self)
self:SetPos(5, 32)
self:SetSize(w - 10, h - 37)
self:SetHTML([[
<html>
<head>
<style>
body {
margin: 0;
overflow: hidden;
}
img {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<img src="https://]] .. v .. [[" />
</body>
</html>
]])
end, fr)
end)
end
end
menu:Open()
end
list.LastSearch = ''
list.Clear = function(self)
for k, v in ipairs(list:GetLines()) do
list:RemoveLine(k)
end
end
list.Search = function(self, find)
for k, v in SortedPairs(pl.sg_tab) do
if pl:GetImmunity() < v.Imm then continue end
local line = {v.Time .. ' (MSK)'}
line[2] = v.Nick .. ' (' .. v.SteamID .. ')'
line[3] = v.Url
line[4] = v.Warn
if string.find(line[2]:lower(), find:lower(), 1, true) then
if v.Url then
line[3] = v.Url
end
if v.Warn then
line[4] = v.Warn
end
list:AddLine(unpack(line)).Copy = {Steamid = v.SteamID, Url = v.Url}
elseif string.find(line[4]:lower(), find:lower(), 1, true) then
if v.Warn then
line[4] = v.Warn
end
list:AddLine(unpack(line)).Copy = {Steamid = v.SteamID, Url = v.Url}
end
end
if (!list:GetLine(1)) then
list:AddLine('')
end
end
list.Think = function(self)
if pl.bScreenGrabMenuReload then self:Clear() self:Full() pl.bScreenGrabMenuReload = false end
local tosearch = string.Trim(txt:GetValue())
if (tosearch ~= '') and (tosearch ~= self.LastSearch) then
self:Clear()
self:Search(tosearch)
self.LastSearch = tosearch
elseif (tosearch == '') and (tosearch ~= self.LastSearch) then
self:Clear()
self.Full()
self.LastSearch = tosearch
end
end
list.Full = function(self)
if pl.sg_tab then
for k, v in pairs(pl.sg_tab) do
if pl:GetImmunity() < v.Imm then continue end
local line = {v.Time .. ' (MSK)'}
line[2] = v.Nick .. ' (' .. v.SteamID .. ')'
if v.Url then
line[3] = v.Url
end
if v.Warn then
line[4] = v.Warn
end
list:AddLine(unpack(line)).Copy = {Steamid = v.SteamID, Url = v.Url}
end
end
end
list:Full()
end)