• DarkRP Chattags help
    5 replies, posted
I have chattags in my server and when i type something in chat it comes up with this [Owner] (OOC) BlackmanCuldesac: hello [Citizen] BlackmanCuldesac: hello [Superadmin] BlackmanCuldesac: // hello This is what happens when i type one work. This is the code im using. Thanks for your help. -- DarkRP ULX Prefixes originally created by Warlock, fixed and recoded by Tabrune. -- rank_str is the prefix shown before the players name, rank_col and bracket_col are colors obviously (RGB). local function AddToChat(msg) local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort()) local name = msg:ReadString() local ply = msg:ReadEntity() ply = IsValid(ply) and ply or LocalPlayer() if name == "" or not name then name = ply:Nick() name = name ~= "" and name or ply:SteamName() end local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort()) local text = msg:ReadString() local rank_str, rank_col, bracket_col if ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("owner") then rank_str = "Owner" rank_col ord operator">= Color( 0, 0, 232 ) bracket_col ord operator">= Color( 0, 0, 232) elseif ply:IsValid() ord">and ply:IsPlayer() and ply:IsUserGroup("developer") then rank_str = "DEV" rank_col = Color( 0, 0, 0 ) bracket_col = Color( 0, 0, 0 ) elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("superadmin") then rank_str = "Super-Admin" rank_col = Color( 232, 0, 0 ) bracket_col = Color( 232, 0, 0 ) ="keyword">elseif ply:IsValid() and ply:IsPlayer() ord">and ply:IsUserGroup("admin") then rank_str = "Admin" rank_col = Color( 25, 25, 112 ) bracket_col = Color( 25, 25, 112 ) ="keyword">elseif ply:IsValid() ="keyword">and ply:IsPlayer() and ply:IsUserGroup("moderat="keyword">or") then rank_str = "Mod" rank_col = Color( 0, 101, 0 ) bracket_col = Color( 0, 101, 0 ) ="keyword">elseif ply:IsValid() ="keyword">and ply:IsPlayer() and ply:IsUserGroup("donor") ="keyword">then rank_str = "Donor" rank_col = Color( 245 ,222 ,179 ) bracket_col ord operator">= Color( 245, 222, 179 ) elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("golddonor") then rank_str = "Gold" rank_col = Color( 255, 215, 0 ) bracket_col = Color( 255, 215, 0 ) elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("silverdonor") then rank_str = "Silver" rank_col = Color( 128, 128, 128 ) bracket_col = Color( 128, 128, 128 ) elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("respected") then rank_str = "VIP" rank_col = Color( 219, 169, 18 ) bracket_col = Color( 219, 169, 18 ) elseif ply:IsValid() and ply:IsPlayer() and ply:IsUserGroup("user") then rank_str = "Player" rank_col = Color( 255, 255, 255 ) bracket_col = Color( 255, 255, 255 ) else rank_str = "" rank_col = Color( 255, 255, 255 ) end if text and text ~= "" then function">chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", col1, name, col2, ": "..text) if IsValid(ply) then hook.Call("OnPlayerChat", nil, ply, text, false, not ply:Alive()) end else chat.AddText(col1, name) hook.Call("ChatText", nil, "0", name, name, "none") end chat.PlaySound() end [highlight](User was banned for this post ("wrong section" - postal))[/highlight]
Try elseif ply:IsValid() and ply:IsPlayer() and ply:IsSuperAdmin() then rank_str = "Super-Admin" rank_col = Color( 232, 0, 0 ) bracket_col = Color( 232, 0, 0 )
Erm pretty sure this is the wrong area to post, as it says DON'T ASK FOR HELP HERE. [highlight](User was banned for this post ("report, don't reply" - postal))[/highlight]
Im sorry here is a updated version of them now Now im getting this Thank you for your quick reply. [Owner] (OOC) BlackmanCuldesac: test [Citizen] BlackmanCuldesac: test -- DarkRP ULX Prefixes originally created by Warlock, fixed and recoded by Tabrune and modify by men232. -- rank_str is the prefix shown before the players name, rank_col and bracket_col are colors obviously (RGB). if SERVER then AddCSLuaFile(); return; end; local stored = {}; local meta = FindMetaTable( "Player" ); local haveNiceFunc = meta.GetUserGroup != nil; local function AddPrefix( group, name, color, bracket_col ) if (group and name and color) then stored[group] = { name = name, color = color, bracket_col = bracket_col }; end; end; local function AddToChat(msg) local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort()) local name = msg:ReadString() local ply = msg:ReadEntity() ply = IsValid(ply) and ply or LocalPlayer() if name == "" or not name then name = ply:Nick() name = name ~= "" and name or ply:SteamName() end local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort()) local text = msg:ReadString() local rank_str, rank_col, bracket_col if (IsValid(ply) and ply:IsPlayer()) then if (!haveNiceFunc) then for group, v in pairs(stored) do if (ply:IsUserGroup(group)) then rank_str = v.name; rank_col = v.color; bracket_col = v.bracket_col or v.color; break; end; end; else local group = ply:GetUserGroup(); local v = stored[group]; if (v) then rank_str = v.name; rank_col = v.color; bracket_col = v.bracket_col or v.color; else rank_str = ""; rank_col = Color( 255, 255, 255 ); end; end; else rank_str = ""; rank_col = Color( 255, 255, 255 ); end; if text and text ~= "" then chat.AddText(bracket_col, bracket_col and " [" or "", rank_col, rank_str, bracket_col, bracket_col and "] " or "", col1, name, col2, ": "..text) if IsValid(ply) then hook.Call("OnPlayerChat", nil, ply, text, false, not ply:Alive()) end else chat.AddText(col1, name) hook.Call("ChatText", nil, "0", name, name, "none") end chat.PlaySound() end timer.Simple(1, function() usermessage.Hook("DarkRP_Chat", AddToChat); end); -- Add Prefixes (group, print name, rank color, bracket color). AddPrefix( "owner", "Owner", Color(0, 0, 232), Color(0, 0, 232) ); AddPrefix( "developer", "DEV", Color(0, 0, 0), Color(0, 0, 0) ); AddPrefix( "superadmin", "Super-Admin", Color(232, 0, 0), Color(232, 0, 0) ); AddPrefix( "admin", "Admin", Color(25, 25, 112), Color(25, 25, 112) ); AddPrefix( "moderator", "Mod", Color(0, 101, 0), Color(0, 101, 0) ); AddPrefix( "donor", "Donor", Color(245 ,222 ,179), Color(245 ,222 ,179) ); AddPrefix( "golddonor", "Gold", Color(255, 215, 0), Color(255, 215, 0) ); AddPrefix( "silverdonor", "Silver", Color(128, 128, 128), Color(255, 215, 0) ); AddPrefix( "respected", "VIP", Color(219, 169, 18), Color(219, 169, 18) ); AddPrefix( "user", "Player", Color(255, 255, 255), Color(255, 255, 255) ); [editline]16th August 2013[/editline] My friend said to post here sorry he just gave me a link.
Still getting the same error?
yeah except one of them are gone now its just two of them.
Sorry, you need to Log In to post a reply to this thread.