Added spy module (Lazy, prints sus messages in chat)
This commit is contained in:
parent
524d7a6c92
commit
b700d3c109
1 changed files with 54 additions and 0 deletions
54
modules/server/sv_spy.txt
Normal file
54
modules/server/sv_spy.txt
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
--@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
|
||||||
|
|
Loading…
Reference in a new issue