21 lines
649 B
Lua
21 lines
649 B
Lua
|
local ENABLED = CreateClientConVar("cbox_greentext", "1", true, false, "Enables greentext", 0, 1)
|
||
|
local COLOR = CreateClientConVar("cbox_greentext_color", "175 201 96", true, false, "Color greentext should be")
|
||
|
|
||
|
local color_white = Color(255, 255, 255)
|
||
|
|
||
|
cbox.hooks.Add("PreChatAddText", "cbox.greentext", function(args)
|
||
|
if not ENABLED:GetBool() then return end
|
||
|
|
||
|
for i, arg in ipairs(args) do
|
||
|
if isstring(arg) and arg:StartsWith(": >") then
|
||
|
args[i] = arg:sub(3)
|
||
|
table.insert(args, i, cbox.utils.ParseColorString(COLOR:GetString()))
|
||
|
table.insert(args, i, ": ")
|
||
|
table.insert(args, i, color_white)
|
||
|
break
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return args
|
||
|
end)
|