Damage Logs TTT

I want to make it so Admins and Mods can print damage logs after death. I have this code :

local function PrintDamageLog(ply)
local pr = GetPrintFn(ply)
if ply:IsAdmin() then
if GetRoundState() == ROUND_ACTIVE and not ply:IsSuperAdmin() and ply:Alive() then ply:ChatPrint(“You may only run this when dead, so go die first.”) return end
ServerLog(Format("%s used ttt_print_damagelog
“, IsValid(ply) and ply:Nick() or “console”))
pr(”*** Damage log:
")

  if not dmglog_console:GetBool() then
     pr("Damage logging for console disabled. Enable with ttt_log_damage_for_console 1.")
  end

  for k, txt in ipairs(GAMEMODE.DamageLog) do
     pr(txt)
  end

  pr("*** Damage log end.")

else
if IsValid(ply) then
pr(“You do not appear to be RCON or a superadmin, nor are we in the post-round phase!”)
end
end
end
concommand.Add(“ttt_print_damagelog”, PrintDamageLog)

local function SaveDamageLog()
if not dmglog_save:GetBool() then return end

local text = “”
if #GAMEMODE.DamageLog == 0 then
text = “Damage log is empty.”
else
for k, txt in ipairs(GAMEMODE.DamageLog) do
text = text … txt … "
"
end
end

local fname = Format(“ttt/logs/dmglog_%s_%d.txt”,
os.date("%d%b%Y_%H%M"),
os.time())
file.Write(fname, text)
end
hook.Add(“TTTEndRound”, “ttt_damagelog_save_hook”, SaveDamageLog)

I haven’t tried it yet because the person said to put it in admin.lua, my question is… where is admin.lua??

edit: I just put it in a file in autorun and got this error

[ERROR] lua/autorun/admin.lua:2: attempt to call global ‘GetPrintFn’ (a nil value)

  1. unknown - lua/autorun/admin.lua:2
  2. unknown - lua/includes/modules/concommand.lua:69

EDIT : I removed that and now its saying that print damage log is an unknown command :confused:

What the hell is “GetPrintFn()” ?.. I mean, I kinda guess what it does but it’s the first time I am seeing it.
It should be just print().

Also, use the damned code tags.

I want to say he’s using that to simplify typing 3 characters when he wants to print

I changed it to print but now it says this when the round ended:

[ERROR] lua/autorun/admin.lua:27: attempt to index global ‘dmglog_save’ (a nil value)

  1. fn - lua/autorun/admin.lua:27
  2. Call - addons/ulib/lua/ulib/shared/hook.lua:183
    3. RoundStateChange - gamemodes/terrortown/gamemode/cl_init.lua:140
    4. Function - gamemodes/terrortown/gamemode/cl_init.lua:214
    5. unknown - lua/includes/modules/usermessage.lua:87