Raised This Month: $37 Target: $400
 9% 

I how get player name with steam id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Swolly
Member
Join Date: Jul 2018
Old 01-13-2019 , 08:08   I how get player name with steam id
Reply With Quote #1

I how get player name with steam id.
Swolly is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-13-2019 , 10:02   Re: I how get player name with steam id
Reply With Quote #2

You mean player name from Steam profile ?

*edit
or from in game ?

Last edited by Bacardi; 01-13-2019 at 10:06.
Bacardi is online now
arne1288
SourceMod Moderator
Join Date: Apr 2012
Old 01-13-2019 , 10:21   Re: I how get player name with steam id
Reply With Quote #3

Code:
public void OnPluginStart()
{
        RegAdminCmd("sm_search_steamid", Command_Search_SteamID, ADMFLAG_ROOT, "Search for Steam ID");
}
public Action Command_Search_SteamID(int client, int args)
{
        if (args < 1)
        {
                ReplyToCommand(client, "[SM] Usage: sm_search_steamid <steamid>");
                return Plugin_Handled;
        }

        char search_for_steamid[32];
        GetCmdArgString(search_for_steamid, sizeof(search_for_steamid));

        ReplyToCommand(client, "Searching for '%s', ...", search_for_steamid);

        for(int i = 1; i <= MaxClients; i++)
        {
                if (IsClientInGame(i) && !IsFakeClient(i))
                {
                        char steamid[32];
                        char player_name[32];
                        if ((GetClientAuthId(i, AuthId_SteamID64, steamid, sizeof(steamid)) && StrEqual(steamid, search_for_steamid) ||
                                GetClientAuthId(i, AuthId_Steam2, steamid, sizeof(steamid)) && StrEqual(steamid, search_for_steamid) ||
                                GetClientAuthId(i, AuthId_Steam3, steamid, sizeof(steamid)) && StrEqual(steamid, search_for_steamid)) &&
                                GetClientName(i, player_name, sizeof(player_name)))
                        {
                                ReplyToCommand(client, "Player name for Steam ID '%s' is: '%s'", search_for_steamid, player_name);
                        }
                }
        }

        return Plugin_Handled;
}
Code:
sm_search_steamid 76561197961798171
Searching for '76561197961798171', ...
Player name for Steam ID '76561197961798171' is: 'DarkDeviL'
sm_search_steamid STEAM_0:1:766221
Searching for 'STEAM_0:1:766221', ...
Player name for Steam ID 'STEAM_0:1:766221' is: 'DarkDeviL'
sm_search_steamid [U:1:1532443]
Searching for '[U:1:1532443]', ...
Player name for Steam ID '[U:1:1532443]' is: 'DarkDeviL'
Something like that?
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread]
arne1288 is offline
Swolly
Member
Join Date: Jul 2018
Old 01-13-2019 , 10:37   Re: I how get player name with steam id
Reply With Quote #4

Quote:
Originally Posted by arne1288 View Post
Code:
public void OnPluginStart()
{
        RegAdminCmd("sm_search_steamid", Command_Search_SteamID, ADMFLAG_ROOT, "Search for Steam ID");
}
public Action Command_Search_SteamID(int client, int args)
{
        if (args < 1)
        {
                ReplyToCommand(client, "[SM] Usage: sm_search_steamid <steamid>");
                return Plugin_Handled;
        }

        char search_for_steamid[32];
        GetCmdArgString(search_for_steamid, sizeof(search_for_steamid));

        ReplyToCommand(client, "Searching for '%s', ...", search_for_steamid);

        for(int i = 1; i <= MaxClients; i++)
        {
                if (IsClientInGame(i) && !IsFakeClient(i))
                {
                        char steamid[32];
                        char player_name[32];
                        if ((GetClientAuthId(i, AuthId_SteamID64, steamid, sizeof(steamid)) && StrEqual(steamid, search_for_steamid) ||
                                GetClientAuthId(i, AuthId_Steam2, steamid, sizeof(steamid)) && StrEqual(steamid, search_for_steamid) ||
                                GetClientAuthId(i, AuthId_Steam3, steamid, sizeof(steamid)) && StrEqual(steamid, search_for_steamid)) &&
                                GetClientName(i, player_name, sizeof(player_name)))
                        {
                                ReplyToCommand(client, "Player name for Steam ID '%s' is: '%s'", search_for_steamid, player_name);
                        }
                }
        }

        return Plugin_Handled;
}
Code:
sm_search_steamid 76561197961798171
Searching for '76561197961798171', ...
Player name for Steam ID '76561197961798171' is: 'DarkDeviL'
sm_search_steamid STEAM_0:1:766221
Searching for 'STEAM_0:1:766221', ...
Player name for Steam ID 'STEAM_0:1:766221' is: 'DarkDeviL'
sm_search_steamid [U:1:1532443]
Searching for '[U:1:1532443]', ...
Player name for Steam ID '[U:1:1532443]' is: 'DarkDeviL'
Something like that?
if client offline
Swolly is offline
sidezz
Senior Member
Join Date: Feb 2012
Location: United States
Old 01-13-2019 , 11:46   Re: I how get player name with steam id
Reply With Quote #5

Quote:
Originally Posted by Swolly View Post
if client offline
you can make a sqlite/mysql database storing player names when they join and when they change their name (player_changename event) and use that
__________________
lol
sidezz is offline
Swolly
Member
Join Date: Jul 2018
Old 01-13-2019 , 12:32   Re: I how get player name with steam id
Reply With Quote #6

Quote:
Originally Posted by sidezz View Post
you can make a sqlite/mysql database storing player names when they join and when they change their name (player_changename event) and use that
Ok, can possible with steam 64 id?
Swolly is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:10.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode