Useful Discovery For Admins And Players In General

Go on any sandbox/base derived server (RP, TTT, Sandbox) and begin typing a players name then press tab, you get name autocomplete.

Raw File:
[lua]
/---------------------------------------------------------
Name: gamemode:OnChatTab( str )
Desc: Tab is pressed when typing (Auto-complete names, IRC style)
---------------------------------------------------------
/
function GM:OnChatTab( str )

local LastWord
for word in string.gmatch( str, "%a+" ) do
     LastWord = word;
end

if (LastWord == nil) then return str end

playerlist = player.GetAll()

for k, v in pairs( playerlist ) do
    
    local nickname = v:Nick()
    
    if ( string.len(LastWord) < string.len(nickname) &&
         string.find( string.lower(nickname), string.lower(LastWord) ) == 1 ) then
            
        str = string.sub( str, 1, (string.len(LastWord) * -1) - 1)
        str = str .. nickname
        return str
        
    end        
    
end
    
return str;

end[/lua]

I discovered this too a while ago.

Oh my god, my life is meaningless now.

I was like :open_mouth: When i found this.

Knew about this. It doesn’t work very well for names with unicode characters in them.

You saved my life with this, I quit meth and got outta rehab!!

If you use special characters in your name you should be slapped.

I agree, but it still doesn’t change the fact that people use them. I tend to notice the mingiest players use them, probably because it’s harder to kick / ban quickly when they have them.

For those of us that are utter idiots,

could someone explain?

If you begin typing a player’s name and press tab, it will automatically complete the name for you.

Also, 1000th post :smiley:

Three years late.

Yet some people don’t know about it. Doesn’t matter if it’s late to just one person.

Now… how to get this into my game…

Its already in all base derived gamemodes.

Honestly, it could probably use a bit of improvement, to cover those unicode names. Just saying.