local function getUser(msg)
local user = ""
local userEnd = msg:find(">")
local closeBr = msg:find(")")
if closeBr == nil or closeBr > userEnd then
return msg:sub(5, userEnd-1)
else
return msg:sub(closeBr+1, userEnd-1)
end
end
add_hook("console", "", function(msg, t)
-- 8 => public msg from someone else
-- 16 => public msg from you
if t == 8 or t == 16 then
echo("user: "..getUser(msg))
else
echo(t)
end
end)
Also, use [code] tags to display code.