Help with lua



local tag = Tags[ply:GetNWString("usergroup")]


how do i make the same thing but it finds the steam id and not the usergroup



local steamid = steamid[ply:SteamID("SteamID")]


what im thinking will work


for k,v in pairs(player.GetAll()) do print(v:SteamID()) end print(LocalPlayer():SteamID())

???



local steamid = steamids[ply:SteamID()]


Although I’m kinda confused in what you’re going to be doing with this.



local Tags = {}
--Tags["rank"] = { RankTextColor, RankText, BracketColor }
Tags["superadmin"] = { Color( 255, 60, 50 ), "Super-Admin", Color( 173, 10, 10 ) }
Tags["admin"] = { Color( 200, 90, 80 ), "Admin", Color( 255, 0, 0 ) }
Tags["operator"] = { Color( 50, 210, 50 ), "Moderator", Color( 0, 242, 255 ) }
Tags["dmod"] = { Color( 50, 210, 50 ), "Donator/Moderator", Color( 255, 192, 0 ) }
Tags["vip"] = { Color( 255, 60, 50 ), "V.I.P", Color( 0, 255, 34 ) }
Tags["dsadmin"] = { Color( 255, 60, 50 ), "Donator/Admin", Color( 0, 255, 34 ) }

local function AddChatTags( ply, msg, team, dead, prefixText, col1, col2 )

		local text = {}
		local tag = Tags[ply:GetNWString("usergroup")]
		
		if tag then
			table.insert( text, tag[3] )
			table.insert( text, "[" )
			table.insert( text, tag[1] )
			table.insert( text, tag[2] )
			table.insert( text, tag[3] )
			table.insert( text, "] " )
		end
		
		if GAMEMODE.FolderName == "darkrp" then
			table.insert( text, col1 )
			table.insert( text, prefixText )
			table.insert( text, col2 )
		else
			table.insert( text, ply )
			table.insert( text, color_white )
		end
		
		table.insert( text, ": " .. msg )
		
		chat.AddText( unpack( text ) )
		
		return true

end
hook.Add( "OnPlayerChat", "DarkRPChatTags", AddChatTags )


need it so i can add chattags per player (even if there in a group)

Yeah I’ll fix that for you, give me a second…



local Tags = {}
--Tags["rank"] = { RankTextColor, RankText, BracketColor }
Tags["superadmin"] = { Color( 255, 60, 50 ), "Super-Admin", Color( 173, 10, 10 ) }
Tags["admin"] = { Color( 200, 90, 80 ), "Admin", Color( 255, 0, 0 ) }
Tags["operator"] = { Color( 50, 210, 50 ), "Moderator", Color( 0, 242, 255 ) }
Tags["dmod"] = { Color( 50, 210, 50 ), "Donator/Moderator", Color( 255, 192, 0 ) }
Tags["vip"] = { Color( 255, 60, 50 ), "V.I.P", Color( 0, 255, 34 ) }
Tags["dsadmin"] = { Color( 255, 60, 50 ), "Donator/Admin", Color( 0, 255, 34 ) }
-- Replace STEAM_0:X:XXXXXX with the user's SteamID.
Tags["STEAM_0:X:XXXXXX"] = { Color(255, 255, 255), "The Tag you want", Color(0, 0, 0)}


local function AddChatTags( ply, msg, team, dead, prefixText, col1, col2 )

        local text = {}
        local tag = Tags[ply:SteamID()] or Tags[ply:GetNWString("usergroup")]
        
        if tag then
            table.insert( text, tag[3] )
            table.insert( text, "[" )
            table.insert( text, tag[1] )
            table.insert( text, tag[2] )
            table.insert( text, tag[3] )
            table.insert( text, "] " )
        end
        
        if GAMEMODE.FolderName == "darkrp" then
            table.insert( text, col1 )
            table.insert( text, prefixText )
            table.insert( text, col2 )
        else
            table.insert( text, ply )
            table.insert( text, color_white )
        end
        
        table.insert( text, ": " .. msg )
        
        chat.AddText( unpack( text ) )
        
        return true

end
hook.Add( "OnPlayerChat", "DarkRPChatTags", AddChatTags )