• Adding Bots with custom names
    1 replies, posted
Im looking to create a .lua file that automatically spawns 3 bots every server restart and gives a random name to them, so ingame thier name looks like a playername and in the server browser. ISSUE: [url]https://gyazo.com/d0f990c391a87f76169cfa193a7e85b3[/url] (Want it to show thier name) 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
Overwriting the Nick/Name metamethods is not needed. Use [url]http://wiki.garrysmod.com/page/player/CreateNextBot[/url] and just pass a name to use. [editline]3rd May 2017[/editline] Upon further inspection this might not work to fake players on the server browser.
Sorry, you need to Log In to post a reply to this thread.