Add command "query" to check if a name is whitelisted

This commit is contained in:
Jordan Irwin 2021-06-09 17:20:58 -07:00
parent 3efef432ac
commit fb0b02b843
4 changed files with 12 additions and 2 deletions

View File

@ -17,6 +17,7 @@ Commands:
- Manages the whitelist.
- Without parameters: displays all whitelisted names
- commands:
- *query:* checks if a name is whitelisted
- *add:* adds a name to whitelist
- *remove:* removes a names from whitelist
- *name:* name of player

View File

@ -1,3 +1,2 @@
TODO:
- add command parameter "query" to check for a whitelisted name

View File

@ -4,6 +4,7 @@ v1.1
- changed license to MIT
- added localization support
- executing "/whitelist" without parameters displays all whitelisted names
- added command "query" to check if a name is whitelisted
v1.0
----

View File

@ -74,7 +74,16 @@ core.register_chatcommand("whitelist", {
return false, S("Must supply name parameter.")
end
if action == "add" then
if action == "query" then
local msg
if whitelist[whitename] then
msg = S("@1 is already on the whitelist.", whitename)
else
msg = S("@1 is not on the whitelist.", whitename)
end
return true, msg
elseif action == "add" then
if whitelist[whitename] then
return false, S("@1 is already on the whitelist.", whitename)
end