Files
wnsrc/lua/autorun/client/gm_demo.lua
lifestorm 94063e4369 Upload
2024-08-04 22:55:00 +03:00

41 lines
1.1 KiB
Lua

--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
concommand.Add( "gm_demo", function( ply, cmd, arg )
if ( engine.IsRecordingDemo() ) then
RunConsoleCommand( "stop" )
return
end
local dynamic_name = game.GetMap() .. " " .. util.DateStamp()
RunConsoleCommand( "record", "demos/" .. dynamic_name .. ".dem" )
RunConsoleCommand( "record_screenshot", dynamic_name )
end, nil, "Start or stop recording a demo.", FCVAR_DONTRECORD )
local matRecording = nil
local drawicon = CreateConVar( "gm_demo_icon", 1, FCVAR_ARCHIVE + FCVAR_DONTRECORD, "If set to 1, display a 'RECORDING' icon during gm_demo." )
hook.Add( "HUDPaint", "DrawRecordingIcon", function()
if ( !engine.IsRecordingDemo() || !drawicon:GetBool() ) then return end
if ( !matRecording ) then
matRecording = Material( "gmod/recording.png" )
end
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetMaterial( matRecording )
surface.DrawTexturedRect( ScrW() - 512, 0, 512, 256 )
end )