READ THE RULES
0 Members and 1 Guest are viewing this topic.
--[[ ProfilePrefix 1.0 LUA 5.1x [Strict][API 2] By Mutor 07/09/10 Set prefixes / tags for your profiles to be used in main chat. - Use your own custom tags/prefixes or default names pulled from hub - Option to have tag within user nick or as nick suffix - Option for letter case none, lower, upper or title case - Option to accept any punctuation for command prefix or hub prefixes only Examples: Tag within nick: <[MASTER]Mutor> test... Tag as suffix: <Mutor> [MASTER] test...]]--Set your profiles / permissions here.-- [#] = "PrefixString"/false, [false = disabled for profile]local Profiles = { [-1] = "[GUEST]", --Unregistered [0] = "[MASTER]", --Master [1] = "[OP]", --Operator [2] = "[VIP]", --Vip [3] = "[REG]", --Registered User }-- Accept any punctuation as command prefix? [false hub command prefix only]local AnyPrefix = false-- Use tag within nick [false = tag as nick suffix]local TagInNick = false-- Use default upper case profile names from PtokaX for all profiles?-- [false = disable, use Profile table above / Set string for unregistered users] = enablelocal Default = false --"[GUEST]"-- Set tags letter case? [0 = no change, 1 = lower case, 2 = upper case, 3 = title case (first cap.)]local LetterCase = 3OnStartup = function() if AnyPrefix then Prefixes = "%p" else Prefixes = SetMan.GetString(29) end if Default then Profiles = {} for i,v in ipairs(ProfMan.GetProfiles()) do local p = v.sProfileName:gsub("%s",string.char(160)) Profiles[v.iProfileNumber] = "["..p.."]" end Profiles[-1] = Default:gsub("%s",string.char(160)) end if LetterCase > 0 then t = {[1] = function(s) return s:lower() end, [2] = function(s) return s:upper() end, [3] = function(s) return s:sub(1,2) :upper()..s:sub(3,-1):lower() end,} for i,v in pairs(Profiles) do Profiles[i] = t[LetterCase](v) end endendChatArrival = function(user,data) local _,_,cmd = data:find("%b<> ["..Prefixes.."](%a+)") if not cmd then local p = Profiles[user.iProfile] if p then local c,d = 0 if TagInNick then d,c = data:gsub("^%<","<"..p) else d,c = data:gsub("^%b<>","%1 "..p) end if c > 0 then return Core.SendToAll(d),true end end endend