• Chat Tags for Nutscript, Unable to add color
    0 replies, posted
Hello I am trying to make chat tags for nutscript. I have successfully created the actual tag, but I cannot add color in the table. When I do it just doesn't show up in chat and I can't figure out why/ No error is given. Below is the code: [CODE] nut.chat.register("ooc", { onCanSay = function(speaker, text) local delay = nut.config.get("oocDelay", 3) -- Only need to check the time if they have spoken in OOC chat before. if (delay > 0 and speaker.nutLastOOC) then local lastOOC = CurTime() - speaker.nutLastOOC -- Use this method of checking time in case the oocDelay config changes. if (lastOOC <= delay) then speaker:notifyLocalized("oocDelay", delay - math.ceil(lastOOC)) return false end end -- Save the last time they spoke in OOC. speaker.nutLastOOC = CurTime() end, onChatAdd = function(speaker, text) local icon = "icon16/user.png" if (speaker:SteamID() == "STEAM_0:1:34930764") then icon = "icon16/script_gear.png" elseif (speaker:SteamID() == "STEAM_0:0:19814083") then icon = "icon16/gun.png" elseif (speaker:IsSuperAdmin()) then icon = "icon16/shield.png" elseif (speaker:IsAdmin()) then icon = "icon16/star.png" elseif (speaker:IsUserGroup("moderator") or speaker:IsUserGroup("operator")) then icon = "icon16/wrench.png" elseif (speaker:IsUserGroup("vip") or speaker:IsUserGroup("donator") or speaker:IsUserGroup("donor")) then icon = "icon16/heart.png" end icon = Material(hook.Run("GetPlayerIcon", speaker) or icon) -- Chat tags local chattag = {Color(255, 50, 50, 255), ""} if (speaker:IsUserGroup("superadmin")) then chattag = {Color(255, 50, 50, 255), " The Torquois "} elseif (speaker:SteamID() == "STEAM_0:0:00000000") then chattag = {Color(255, 50, 50, 255), " The Example "} elseif (speaker:IsUserGroup("vip") or speaker:IsUserGroup("donator")) then chattag = {Color(255, 50, 50, 255), " VIP "} end --icon = Material(hook.Run("GetPlayerIcon", speaker) or icon) chat.AddText(icon, unpack(chattag), Color(255, 50, 50), " [OOC] ", speaker, color_white, ": "..text) end, prefix = {"//", "/ooc"}, noSpaceAfter = true, filter = "ooc" }) [/CODE] [editline]12th June 2017[/editline] Solved using an entirely new table for color alone. It's very inefficent, but it works!
Sorry, you need to Log In to post a reply to this thread.