-- Out of character.
local ICON_USER = "icon16/user.png"
local ICON_HEART = "icon16/heart.png"
local ICON_WRENCH = "icon16/wrench.png"
local ICON_STAR = "icon16/star.png"
local ICON_SHIELD = "icon16/shield.png"
local ICON_DEVELOPER = "icon16/wrench_orange.png"
-- Out of character.
nut.chat.register("ooc", {
onCanSay = function(speaker, text)
local delay = nut.config.get("oocDelay", 10)
-- 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 = ICON_USER
if (speaker:SteamID() == "STEAM_0:1:1") then
icon = ICON_DEVELOPER
elseif (speaker:IsSuperAdmin()) then
icon = ICON_SHIELD
elseif (speaker:IsAdmin()) then
icon = ICON_STAR
elseif (speaker:IsUserGroup("operator")) then
icon = ICON_WRENCH
elseif (speaker:IsUserGroup("donator")) then
icon = ICON_HEART
end
icon = Material(icon)
chat.AddText(icon, Color(250, 40, 40), "[OOC] ", speaker, color_white, ": "..text)
end,
prefix = {"//", "/ooc"},
noSpaceAfter = true,
filter = "ooc"
})