• Help with lua
    4 replies, posted
[code] local tag = Tags[ply:GetNWString("usergroup")] [/code] how do i make the same thing but it finds the steam id and not the usergroup [code] local steamid = steamid[ply:SteamID("SteamID")] [/code] what im thinking will work
[code]for k,v in pairs(player.GetAll()) do print(v:SteamID()) end print(LocalPlayer():SteamID())[/code] ???
[code] local steamid = steamids[ply:SteamID()] [/code] Although I'm kinda confused in what you're going to be doing with this.
[code] 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 ) [/code] 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... [code] 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 ) [/code]
Sorry, you need to Log In to post a reply to this thread.