fix double screenshot

This commit is contained in:
Linventif 2024-01-24 01:14:46 +01:00
parent 51fba632d8
commit 0688f74629

View File

@ -34,8 +34,14 @@ function gmInte.openAdminConfig()
end
local ScreenshotRequested = false
local frameCount = 0
hook.Add("PostRender", "gmInteScreenshot", function()
if (!ScreenshotRequested) then return end
frameCount = frameCount + 1
if (frameCount < 2) then return end
ScreenshotRequested = false
local captureData = {
@ -64,17 +70,14 @@ hook.Add("PostRender", "gmInteScreenshot", function()
gmInte.log("Screenshot failed to send to Discord, error code: " .. code, true)
end
)
file.Write( "image.png", data )
end)
function gmInte.takeScreenShot(serverID, authToken)
gmInte.config.id = serverID
gmInte.config.token = authToken
timer.Simple(0.2, function()
ScreenshotRequested = true
end)
frameCount = 0
end
//