Last join time info

Hi everyone!
I was wondering if anyone could point me in the direction of addon that shows las join time in chat when player connects. Something like “NAME last joined 30 hours ago”.

I know the admin mod “Evolve” has this, and is probably what you have seen.

Thanks, other ways?

I don’t think there are any other addons, you could always code it yourself or hire someone.

Yeah, it’s true. But i don’t have time…

[lua]local function formatSteamID(stid)
– File names cannot contain colons, so we replace them here
return string.gsub(stid, “:”, “_”)

local function formatTimeDifference(time) – All we have is a number- make it pretty
local diff = os.time() - time – diff will be in seconds

local amt = 0
local unit = ""

if (diff < 60) then
	return "less than one minute ago"
elseif (diff >= 60 and diff < 3600) then -- 1 minute to 1 hour
	amt = math.floor(diff / 60)
	unit = "minute"
elseif (diff >= 3600 and diff < 86400) then -- 1 hour to 1 day
	amt = math.floor(diff / 3600)
	unit = "hour"
elseif (diff >= 86400 and diff < 604800) -- 1 day to 1 week
	amt = math.floor(diff / 86400)
	unit = "day"
else -- more than 1 week, you get the drill
	amt = math.floor(diff / 604800)
	unit = "week"

if (amt > 1) then unit = unit .. "s" end -- Plurals are cool, too

return amt .. " " .. unit .. " ago"


local function chatAll(text)
for k, v in pairs(player.GetAll()) do

local function GetLastJoinTime(pl)
local fname = “jointimes/” … formatSteamID(pl:SteamID()) … “.txt”

local retval = false
if (file.Exists(fname, "DATA")) then
	retval = true
	pl.LastJoinTime = tonumber(file.Read(fname, "DATA"))

file.Write(fname, os.time())

return retval


hook.Add(“PlayerInitialSpawn”, “LastJoinTime”, function(pl)
if (GetLastJoinTime(pl)) then
chatAll(pl:Name() … " has connected. Last joined " … formatTimeDifference(pl.LastJoinTime) … “.”)
chatAll(pl:Name() … " has connected for the first time.")

Untested, but this should work. Stores timestamps in text files. Not the best method but it’s quick and easy.
For Christ’s sake I hate posting Lua, the forums always manage to fuck me.

Should probably get in the habbit of string.lower on the file.write now that the new ‘bug’ is considering a feature.

I gonna test it. Anyway it’s a really good base! Thanks, man!