#trackPrint

1 messages · Page 1 of 1 (latest)

surreal wolf
#

Ive improve your idea a bit

local cvar = CreateConVar("debugprints", "0", FCVAR_ARCHIVE)
local old

local function OnChange(bool)
    if CLIENT and LocalPlayer():IsSuperAdmin() == false then return end

    if bool then
        old = old or print
        print = function(...)
            debug.Trace()
            old(...)
        end
    else
        print = old
    end
end

OnChange(cvar:GetBool())

cvars.AddChangeCallback("debugprints", function(_, _, bool)
    OnChange(bool)
end, "debug")

concommand.Add("trackprint", function(ply, _, args, str)
    if ply:IsSuperAdmin() == false then return end

    if args[1] == nil then return print("pass phrase arg to track prints") end

    old = old or print
    print = function(...)
        if table.concat({...}, ""):find(str) then
            debug.Trace()
            print = old
        end

        old(...)
    end
end)
wicked raven
#

me when I tell him ctrl+f exists

#

Cool nonetheless, though

keen onyx
#

i knew somebody was going to say use find, what if it wasnt just like "test" and it was like a steam id or something and u dunno what script is causing that, u aint gonna search everyone using that func lol

wicked raven
#

true