36 lines
962 B
Lua
36 lines
962 B
Lua
core.register_chatcommand("effect", {
|
|
params = "add|remove <player> <effect> <time> <multiplier>",
|
|
description = "Add or Remove <effect> from <player>",
|
|
privs = {give = 1},
|
|
func = function (name, param)
|
|
local split = param:split(" ")
|
|
|
|
if #split < 3 then
|
|
return false, "Invalid syntax: " .. param
|
|
end
|
|
|
|
local option = split[1]
|
|
local targets = PyuTest.chatcommand_entity_selector(name, split[2])
|
|
local effect = split[3]
|
|
|
|
for _, v in pairs(targets) do
|
|
if not core.get_player_by_name(v) then
|
|
core.chat_send_player(name, "Invalid player: " .. v)
|
|
return
|
|
end
|
|
end
|
|
|
|
if option == "add" and #split == 5 then
|
|
local time = tonumber(split[4])
|
|
local multiplier = tonumber(split[5]) or 2
|
|
for _, v in pairs(targets) do
|
|
PyuTest.status_effect_add(v, effect, multiplier, time)
|
|
end
|
|
elseif option == "remove" and #split == 3 then
|
|
for _, v in pairs(targets) do
|
|
PyuTest.status_effect_remove(v, effect)
|
|
end
|
|
end
|
|
end
|
|
})
|