A way to get an offline player steam name? (100+ people)

I didn’t code for like half a year now and forgot a lot of things so 'scuse me if this makes no sense or is too easy but…
I’ve got a list (100± of people) of Steam IDs and every time a player opens a VGUI I need to get the Steam name of each one of them. I figured that if I just save the name the user can just change it thus it becoming outdated.
I can still save it and pass a check on player spawn if it changed since last time but is there another possible way which I may be missing?
I could also post the 64 ID to a php checker and return the name but that may actually load the server too much if a player spams the VGUI would it not?

Just create a table using their SteamID64 as the key and their name as the value, then when this is called (if using DarkRP) else when they join using this and when they leave using this update the table. Store the table with whatever method you prefer, txt document, MySQL, whatever.

There is a hook for when a player changes their name but I can’t be bothered to find it
then all you need to do is tbl[ply:SteamID64()] to get their name.

That is what I thought to do but this has flaws like what if a guy changes the name mid-game without leaving? Also that DarkRP hook is for the /name thing, not steam name

There must be a hook for player name change, TTT kicks you if you change your name, so there is a method of seeing if they change their name.

the same way hacks check if there is a player name change, store their id and name in a table upon connect, then check if their name has changed (and id is same)

[LUA]
local playernames = {}

timer.Create( “UpdatePlayerNames”, 30, 0, function()
for _, ply in pairs( player.GetAll() ) do
local correct = playernames[ply:SteamID()] == ply:Nick()
if not correct then playernames[ply:SteamID()] = ply:Nick() end
end
end )
[/LUA]

then you can save playernames to whatever and use that

Track players: https://dl.dropboxusercontent.com/u/26074909/tutoring/tracking_players/player_connect_and_disconnect.lua.html

With the list implemented: https://dl.dropboxusercontent.com/u/26074909/tutoring/tracking_players/player_connect_and_disconnect_with_list_example.lua.html

There are ways to detect when a player changes their name mid-game using game-events: https://dl.dropboxusercontent.com/u/26074909/tutoring/game_event_listeners.lua.html

For offline users, if you know the Steam you can do an HTTP Fetch for their info.

table.HasValue is inefficient

Of course it is, when you’re calling it many many times each frame: https://dl.dropboxusercontent.com/u/26074909/tutoring/benchmarking_tips/benchmarking_hud_stuff.lua.html

Now, if it is only being called when a player connects, then there is no issue. Also, how often do players change names? The table will be a size of 1 most likely. Also, all of the names need to be processed anyway if you want to keep a record of unique names; whether a loop is used to go through all, or table.HasValue is used, it doesn’t matter - it is still O( n ).

if called multiple times very quickly, sure

the performance loss is inconsequential in this context.
there’s absolutely no need to tack more code onto this <10 line problem

you’re both forgetting the first rule of optimization

-snip, just realised you meant Steam name-