--- Admin commands local function GetPrintFn(ply) if IsValid(ply) then return function(...) local t = "" for _, a in ipairs({...}) do t = t .. "\t" .. a end ply:PrintMessage(HUD_PRINTCONSOLE, t) end else return print end end local function TraitorSort(a,b) if not IsValid(a) then return true end if not IsValid(b) then return false end if a:GetTraitor() and (not b:GetTraitor()) then return true end if b:GetTraitor() and (not a:GetTraitor()) then return false end return false end function PrintTraitors(ply) if not ValidEntity(ply) or ply:IsSuperAdmin() then ServerLog(Format("%s used ttt_print_traitors\n", IsValid(ply) and ply:Nick() or "console")) local pr = GetPrintFn(ply) local ps = player.GetAll() table.sort(ps, TraitorSort) for _, p in pairs(ps) do if ValidEntity(p) then pr(p:GetTraitor() and "TRAITOR" or "Innocent", ":", p:Nick()) end end end end concommand.Add("ttt_print_traitors", PrintTraitors) function PrintGroups(ply) local pr = GetPrintFn(ply) pr("User", "-", "Group") for _, p in pairs(player.GetAll()) do pr(p:Nick(), "-", p:GetNWString("UserGroup")) end end concommand.Add("ttt_print_usergroups", PrintGroups) function PrintReport(ply) local pr = GetPrintFn(ply) if not ValidEntity(ply) or ply:IsSuperAdmin() then ServerLog(Format("%s used ttt_print_adminreport\n", IsValid(ply) and ply:Nick() or "console")) for k, e in pairs(SCORE.Events) do if e.id == EVENT_KILL then if e.att.uid == -1 then pr(" killed " .. e.vic.ni .. (e.vic.tr and " [TRAITOR]" or " [inno.]")) else pr(e.att.ni .. (e.att.tr and " [TRAITOR]" or " [inno.]") .. " killed " .. e.vic.ni .. (e.vic.tr and " [TRAITOR]" or " [inno.]")) end end end else if ValidEntity(ply) then pr("You do not appear to be RCON or a superadmin!") end end end concommand.Add("ttt_print_adminreport", PrintReport) CreateConVar("ttt_highlight_admins", "1") local function ApplyHighlightAdmins(cv, old, new) SetGlobalBool("ttt_highlight_admins", tobool(tonumber(new))) end cvars.AddChangeCallback("ttt_highlight_admins", ApplyHighlightAdmins) local dmglog = CreateConVar("ttt_log_damage_for_console", "0") local function PrintDamageLog(ply) local pr = GetPrintFn(ply) if (not ValidEntity(ply)) or ply:IsSuperAdmin() or GetRoundState() == ROUND_POST then ServerLog(Format("%s used ttt_print_damagelog\n", IsValid(ply) and ply:Nick() or "console")) pr("*** Damage log:\n") if not dmglog: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 ValidEntity(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) function DamageLog(txt) ServerLog(txt .. "\n") if dmglog:GetBool() then table.insert(GAMEMODE.DamageLog, txt) end end