Raised This Month: $ Target: $400
 0% 

[REQ] Change player name ingame based on SteamID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dropslays
Junior Member
Join Date: Feb 2016
Old 10-09-2016 , 18:46   [REQ] Change player name ingame based on SteamID
Reply With Quote #1

Hey everyone, I'm looking for a plugin to be made that allows me to define a KV paired list of usernames to SteamIDs so that when a player joins, his SteamID is looked up and his name is automatically changed to the username associated with it in the list.

I've done some searching and there's only one thread that provides a solution similar to this and it wouldn't function properly anymore when I test it. Any help would be appreciated!

-drop
dropslays is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-10-2016 , 10:37   Re: [REQ] Change player name ingame based on SteamID
Reply With Quote #2

PHP Code:
#include <sdktools>

public void OnClientPostAdminCheck(client)
{
    if(
IsFakeClient(client)) return;

    
char buffer[PLATFORM_MAX_PATH];
    
BuildPath(Path_SMbuffersizeof(buffer), "data/RenamePlayer.txt");

    if(!
FileExists(buffer)) return;


    
KeyValues kv = new KeyValues("data");
    if(
kv.ImportFromFile(buffer))
    {
        if(
GetClientAuthId(clientAuthId_Enginebuffersizeof(buffer), true) && kv.JumpToKey(bufferfalse))
        {
            
kv.GetString("name"buffersizeof(buffer), NULL_STRING);

            if(!
StrEqual(bufferNULL_STRINGfalse))
            {
                
SetClientName(clientbuffer);
            }
        }
    }
    
delete kv;

...addons/sourcemod/data/RenamePlayer.txt
Code:
"data"
{

	"STEAM_1:1:1410000"
	{
		"name"	"Bacardi"
	}


	"STEAM_1:1:1410001"
	{
		"name"	"Bacardi"
	}


	"STEAM_1:1:1410002"
	{
		"name"	"Bacardi"
	}


	"STEAM_1:1:1410003"
	{
		"name"	"Bacardi"
	}


	"STEAM_1:1:1410004"
	{
		"name"	"Bacardi"
	}

}
__________________
Do not Private Message @me

Last edited by Bacardi; 10-10-2016 at 10:38.
Bacardi 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 19:55.


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