Renaming Players (Bots preferrably)

I am looking for any type of ulx plugin/lua script/addon that will allow an admin to rename a player. I know Sourcemod has this, however Metamod will not work with Gmod13… So does anyone know of anything that will do this? If so please link.

I run roleplay servers and put a lot of effort into adding bots and NPCs to add to the atmosphere of the roleplay. Hence why the “Just ask them to change their name.” response I know a few of you have will not work in this case.

I know CS:S you can change the vpk files to do so… If anyone knows which vpk specifically has bot information, or the innards of that file so I can .db -> .vpk it to replace the server file, PLEASE share.

Greatly appreciated!

you could override Nick() and store/send the names of people to the client and server

try running SetName() on the bot. Have no idea if it’ll work or not.

Where do I find those at? I am not much of a lua coder…
I believe the setname was removed a while back but might be something different I am thinking of.

[LUA]
local pMeta = FindMetaTable( “Player” )
local oldNick = pMeta.Nick

local BotNames = { “Caboose”, “John Doe” }

function pMeta:Nick()
if not self:IsBot() then return oldNick(self) end
if self.BotName then return self.BotName end

self.BotName = table.Random( BotNames )
return self.BotName

end
[/LUA]

?

Just make sure that you make it auto-refresh compatible by storing the old table forever. If you don’t you can create a stack-overflow when the game-mode is refreshed.

What I do is use ALL CAPS to designate a CONST occasionally with 2 __s. I usually use __ to designate internal things which shouldn’t be messed with. It’s good to do if you may use PLAYER_NICK anywhere else.

[lua]local pMeta = FindMetaTable( “Player” )

if ( !__PLAYER_NICK ) then __PLAYER_NICK = pMeta.Nick; end

local BotNames = { “Caboose”, “John Doe” }
function pMeta:Nick( )
if ( !self:IsBot( ) ) then return __PLAYER_NICK(self); end
if ( self.BotName ) then return self.BotName; end

self.BotName = table.Random( BotNames );
return self.BotName;

end[/lua]

or

[lua]local pMeta = FindMetaTable( “Player” )

if ( !PLAYER_NICK ) then PLAYER_NICK = pMeta.Nick; end

local BotNames = { “Caboose”, “John Doe” }
function pMeta:Nick( )
if ( !self:IsBot( ) ) then return PLAYER_NICK(self); end
if ( self.BotName ) then return self.BotName; end

self.BotName = table.Random( BotNames );
return self.BotName;

end[/lua]

So how would I incorporate this into a server? Just turn that into a .lua file and put it where?

Yeah, autorun/server works best

But does this actually change their name or is it just that way to “trick” DarkRP?

Overriding the metafunction just tricks the scripts; their name isn’t actually being changed.

If you can get the bot entities (player.GetAll + pl.IsBot) then http://wiki.garrysmod.com/page/Entity/SetName is better.

Some RP gamemodes have the option to set the name of players. For example, in DarkRP you can do rp_setname bot01 “John Doe”, which will set bot01’s RPname to John Doe.

Unless I’m mistaken,[sp]Clockwork and[/sp]NutScript also has /charsetname or a similarly worded command built into the framework.

you can’t spawn bots in clockwork/nutscript

unless darkrp changes how they handle bots names compared to players you can’t do it that way. the way peoples nicks are stored is

player join -> store name in sqlite so that people can’t just use their steam name

False, CW load a random generated character for bot

Would that also change their name in the server browser

[lua]
function pmeta:Nick()

return “10/10”

end
[/lua]

something like that won’t change their name in the server browser iirc.

I tried tthe SetName method and all I got were pointshop errors