Disconnect reasons

Is it possible to make a chat message like “JackYack13 has left the server (kicked)” or “someone has left the server (timeout)” ? So far i have this:
[lua]
if CLIENT then

local function GM_Print(ply, command, args)
local cmd = args[1]
if (cmd == “disconnect”) then
chat.AddText(team.GetColor(tonumber(args[3])), args[2], Color(200, 255, 230), " has left the server.")
end
end

concommand.Add(“gm_print”, GM_Print)

end

if SERVER then

local function Disconnect(ply)
SpawnPlace[ply:SteamID()] = nil
local name = ply:Name()
local pteam = ply:Team()
for k,v in pairs(player.GetAll()) do
v:ConCommand(“gm_print disconnect “” … name … “” “” … pteam … “””)
end
end
hook.Add(“PlayerDisconnected”, “Disconnect”, Disconnect)

end
[/lua]
But this only says “player has left the server” without telling the reason. Is there any way to get the reason too and include it in the message?

Also is it possible to disable the default connect and disconnect messages?

that code gave me aids.

[lua]
function OverRideLeavingReasons(p, c, a)
local nick = p:Nick()
local steamid = p:SteamID()
if a[1] == “disconnect” then
for k, v in pairs(player.GetAll()) do
v:ChatPrint(nick…" | “…steamid…” has left the server (Disconnect By User.)")
end
end
end

function PlayerHasDisconnected(ply)
OverRideLeavingReasons(ply, “disconnect”)
end

hook.Add(“PlayerDisconnected”, “DCBrah”, PlayerHasDisconnected)
[/lua]
Something like that might work.

Your code is even worse.

[lua]hook.Add(“ChatText” , 0 , function(pind, pl, text, type)
if type == “joinleave” then
if text:match(“timed”) then
print(pl:Nick() … " has left the server (timeout)")
elseif text:match(“disconnect”)
print(pl:Nick() … " has left the server (disconnected)")
elseif text:match(“kicked”) then
print(pl: Nick() … " has left the server (kicked)")
end
return
end
end ) [/lua]