A command for ban history, slays, gags, mutes, kicks, and hours played?

I am a bit confused on how I would go about this, as I am not an expert in Lua, but I’ve seen this around on different Garry’s Mod servers, where you would type in a command !stats and it would pop up with a GUI which had your hours played, the amount of slays, gags, mutes, kicks, and your ban history.

Staff were able to target specific players and see there stats, as well if they were offline, they could input their Steam ID and still see their stats.

!stats “NAME HERE”

Anybody mind helping me out with this, or have you seen an addon which already does something like this?

I am also using the ULX admin mod, if that helps in anyway.

So far I know, there are no admin-mods that support ban/kick-history other than the txt log they create on the server.

Alright, I tried a little, and have a quick question before going, I am making it where whenever the commands, !gag, !mute, !kick, and !slaynr (!slay works too), will add it to the PData with SetPData.

I was only able to find where ULX handles the kick command and got this,

local currentKicks = ply:GetPData("timesKicked",0)
currentKicks = currentKicks + 1

I haven’t tested it, but here are the files so far I have made.


--[[ Player Stats | Server Side ]]--

if SERVER then
	hook.Add("PlayerSay", "OpenGUI", function(ply, text, public) -- Chat Command to open the GUI
		local text = string.lower(text)
		if (string.sub(text, 1, 8) == string.lower("!stats")) then
	concommand.Add("stats", function(ply) -- Console Command to open the GUI
	end )


--[[ Player Stats | Client Side ]]--

--[[ PData Name = Description
timesKicked = Times the Player has been Kicked
timesSlain = Times the Player has been Slain
timesGagged = Times the Player has been Gagged
timesMuted = Times the Player has been Muted

if CLIENT then
	local Frame = nil
	function OpenPlayerStats()
		local ply = LocalPlayer()
		local currentKicks = ply:GetPData("timesKicked",0)
		local currentSlain = ply:GetPData("timesSlain",0)
		local currentGagged = ply:GetPData("timesGagged",0)
		local currentMuted = ply:GetPData("timesMuted",0)
		-- Creating the GUI
		Frame = vgui.Create("DFrame")
		Frame:SetPos(700, 400)
		Frame:SetSize(500, 300)
		Frame:SetTitle("Divinity TTT Player Stats")
	net.Receive("OpenPlayerStats", function(len, ply) 

Where are the commands, !gag, !mute, and !slaynr (when the player is slain) handled like the !kick command?

Also, I have no idea how I would incorporate the ban history in it.

Well, what you could do is modify the ulx.fancyLog to search for the texts “banned”, “kicked”, etc. and register it. This is the easiest way to do it without modifying all command’s functions…

[editline]14th September 2014[/editline]

Or at least the easiest way i can think of now

is where kick, ban is held
slaynr is a thing that we wont know because you’re the one who added it, mute and gag is in

Actually, gag and mute are in chat.lua, all I need now is ban history, which I have no idea how to do.

oh shit i didnt realise i said util.lua, but yeah, its in chat.lua. ban history, file.Write?