mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
fix double screenshot
This commit is contained in:
parent
51fba632d8
commit
0688f74629
|
@ -34,11 +34,17 @@ function gmInte.openAdminConfig()
|
||||||
end
|
end
|
||||||
|
|
||||||
local ScreenshotRequested = false
|
local ScreenshotRequested = false
|
||||||
hook.Add("PostRender", "gmInteScreenshot", function()
|
local frameCount = 0
|
||||||
if (!ScreenshotRequested) then return end
|
|
||||||
ScreenshotRequested = false
|
|
||||||
|
|
||||||
local captureData = {
|
hook.Add("PostRender", "gmInteScreenshot", function()
|
||||||
|
if (!ScreenshotRequested) then return end
|
||||||
|
|
||||||
|
frameCount = frameCount + 1
|
||||||
|
if (frameCount < 2) then return end
|
||||||
|
|
||||||
|
ScreenshotRequested = false
|
||||||
|
|
||||||
|
local captureData = {
|
||||||
format = "png",
|
format = "png",
|
||||||
x = 0,
|
x = 0,
|
||||||
y = 0,
|
y = 0,
|
||||||
|
@ -64,17 +70,14 @@ hook.Add("PostRender", "gmInteScreenshot", function()
|
||||||
gmInte.log("Screenshot failed to send to Discord, error code: " .. code, true)
|
gmInte.log("Screenshot failed to send to Discord, error code: " .. code, true)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
file.Write( "image.png", data )
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function gmInte.takeScreenShot(serverID, authToken)
|
function gmInte.takeScreenShot(serverID, authToken)
|
||||||
gmInte.config.id = serverID
|
gmInte.config.id = serverID
|
||||||
gmInte.config.token = authToken
|
gmInte.config.token = authToken
|
||||||
|
|
||||||
timer.Simple(0.2, function()
|
ScreenshotRequested = true
|
||||||
ScreenshotRequested = true
|
frameCount = 0
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue
Block a user