Find a person by their SteamID

I need a clientside script that will take a steamid i provide it, and find the player that it belongs to.

Im not a lua coder, but i can understand enough to cope in occasions. My attempt doesnt seem to work like i need it

[lua]

function FindPlayer()
for _, v in ipairs( player.GetAll() ) do
if( player:SteamID() == “STEAMID” ) then
print( v:SteamID()…"'s name is: "…v:Nick() )
end
end

[/lua]

Could someone assist me?

Where are you getting ply from?
And where the hell is that other end?

as i stated above, i dont know lua, bearly any tbh. i dont have a keen eye to mistakes like that, i read it all the same.

[lua]function FindPlayer()
for _, v in ipairs( player.GetAll() ) do
if( v:SteamID() == “STEAMID” ) then --First this was ply:SteamID later it became player:SteamID, both wrong
print( v:SteamID()…"'s name is: "…v:Nick() )
end --This end was missing
end
end[/lua]

ha, thanks

[lua]
function FindPlayer(ply,cmd,args)
if not args[1] then return false end
for _, v in ipairs( player.GetAll() ) do
if( v:SteamID() == args[1] ) then
ply:ChatPrint("Player Found - "…v:Nick())
end
end
end
concommand.Add(“FindPlayer”,FindPlayer)
[/lua]

You run FindPlayer steamid and it prints the players nick to chat only if they are in the server.
Basically thejjokerr’s code but modified.

www.steamidfinder.com ?

Theres this cool new thing where if you type status in the console, it brings up all the steamids of the people in the server.

[lua]function FindPlayer( id )
if not tostring(id) then return; end
for _, v in ipairs( player.GetAll() ) do
if( string.find(v:SteamID(), tostring(id)) )then
print( v:SteamID()…"'s name is: " … v:Nick() )
end
end
end
[/lua]
Easy as it is.

FindPlayer(“790467”)

Why would he need to put in a fragment of SteamID?

[lua]
function FindPlayer( id )
if not tostring(id) then return; end
for _, v in ipairs( player.GetAll() ) do
if v:SteamID() == id then
return v
end
end
end

–With that function you can do more stuff

FindPlayer(“STEAM_blabla”):Kill()
print(FindPlayer(“STEAM_blabla”):Nick())
[/lua]

Touché. That’ll do it too. But yeah. I still prefer to use string.find if you don’t know all of the id.

But when you do a lookup with SteamID, you’re supposed to know the whole SteamID.

Yeah. Funny thing is, You don’t always.

Or cba to type the STEAM_ part

Another possibility… Oh you lazy bastards today :slight_smile: