Raised This Month: $32 Target: $400
 8% 

I how get player name with steam id


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Swolly
Senior Member
Join Date: Jul 2018
Location: Turkey
Old 01-13-2019 , 07: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 , 09: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 09:06.
Bacardi is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 01-13-2019 , 09: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].
DarkDeviL is offline
Swolly
Senior Member
Join Date: Jul 2018
Location: Turkey
Old 01-13-2019 , 09: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
sdz
Senior Member
Join Date: Feb 2012
Old 01-13-2019 , 10: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
sdz is offline
Swolly
Senior Member
Join Date: Jul 2018
Location: Turkey
Old 01-13-2019 , 11: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



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 22:50.


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