-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create antichat.lua #12
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
modname="Antichat" | ||
version="1.0" | ||
|
||
function et_InitGame() | ||
et.RegisterModname(modname.." "..version) | ||
end | ||
-- Antichat by Ryven | ||
-- Allow only wolfadmin commands to be passed | ||
|
||
local blackList = { "say", "say_team", "say_buddy", "say_teamnl", "m", "pm" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this mod could be effectively called vsay fest :D |
||
local whitelist = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the point in hardcoding wolfadmin stuff, like why being responsible for maintaining the list? Instead you could just suggest people to put wofladmin first to load in the lua modules list, then it will be able to parse its own stuff first, then passing control further here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, there is |
||
"!help", | ||
"!admintest", | ||
"!greeting", | ||
"!rules", | ||
"!stats", | ||
"!sprees", | ||
"!listmaps", | ||
"!time", | ||
"!listplayers", | ||
"!finger", | ||
"!listaliases", | ||
"!listlevels", | ||
"!showwarns", | ||
"!showhistory", | ||
"!dewarn", | ||
"!showbans", | ||
"!warn", | ||
"!put", | ||
"!mute", | ||
"!unmute", | ||
"!vmute", | ||
"!vunmute", | ||
"!plock", | ||
"!punlock", | ||
"!kick", | ||
"!ban", | ||
"!unban", | ||
"!slap", | ||
"!gib", | ||
"!setlevel", | ||
"!incognito", | ||
"!balance", | ||
"!lock", | ||
"!unlock", | ||
"!shuffle", | ||
"!shufflesr", | ||
"!spec999", | ||
"!swap", | ||
"!cointoss", | ||
"!nextmap", | ||
"!pause", | ||
"!unpause", | ||
"!reset", | ||
"!restart", | ||
"!enablevote", | ||
"!needbots", | ||
"!kickbots", | ||
"!putbots", | ||
"!readconfig", | ||
"!listlevels", | ||
"!resetsprees" | ||
} | ||
|
||
local function contains(table, value) | ||
if value == "" then | ||
return false | ||
end | ||
for i = 1, #table do | ||
if table[i] == value then | ||
return true | ||
end | ||
end | ||
return false | ||
end | ||
|
||
function et_ClientCommand(clientNum, command) | ||
if contains(blackList, command) then | ||
local arg = et.trap_Argv(1) | ||
if not contains(whitelist, arg) then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't work in case shrub command will have arguments. Argv 1 will return full text string passed to |
||
return 1 | ||
end | ||
end | ||
return 0 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait what? I have no memory of this script D: