lsft/modules/server/sv_spy.txt

54 lines
No EOL
1.6 KiB
Text

--@name
--@author
--@server
do
core.defaultconfig.spy = {
printToConsole = 0,
startState = 1
}
local state = 0
local printToConsole = core:get_config("spy", "printToConsole")
local function toggleSpy()
if state == 0 then
hook.add("PlayerSay", "LSFT-Spy", function(ply, text)
local function angryPrint(ply, text)
if tonumber(printToConsole) == 0 then
core:log(log.TEXT, team.getColor(ply:getTeam()), ply:getName(), core.colors.text, ": "..text)
else
core:logConsole(log.TEXT, team.getColor(ply:getTeam()), ply:getName(), core.colors.text, ": "..text)
end
end
-- Ugly and stupid
if ply ~= owner() and (string.find(text, "^!") or string.find(text, "^@") or string.find(text, "^#") or string.find(text, "^-")) then
angryPrint(ply, text)
end
end)
state = 1
elseif state == 1 then
hook.remove("PlayerSay", "LSFT-Spy")
state = 0
end
end
-- meh
if tonumber(core:get_config("spy", "startState")) == 1 then
toggleSpy()
end
core.modules.spy = {
version = 1,
desc = "Soviet grade chat survelliance!",
commands = {
spy = {
usage = "spy",
desc = "Toggles on/off printing *potentially* hidden messages to your chat window/console.",
func = toggleSpy,
},
}
}
end