From 612039cc2600a05df83a94175509f271bb9d96fa Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Fri, 14 May 2021 03:26:50 +0200 Subject: [PATCH] Code cleaning --- init.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index b4c66d6..7fbeb68 100644 --- a/init.lua +++ b/init.lua @@ -2769,12 +2769,12 @@ if rawget(_G, "awards") then core.register_on_dieplayer(set_fs) end -core.register_on_chatcommand(function(name, command, params) - if sub(command, 1, 5) == "grant" then - params = split(params, " ") +local _privs = {"creative", "teleport", "all"} - for _, v in ipairs(params) do - if find(v, "creative") or find(v, "all") then +core.register_on_chatcommand(function(name, command, params) + if sub(command, 1, 5) == "grant" or sub(command, 1, 6) == "revoke" then + for _, priv in ipairs(_privs) do + if sub(params, -#priv) == priv then local data = pdata[name] reset_data(data) data.favs = {}