smart_chat-cd2025/cmd_join.lua
2020-11-21 22:01:19 +01:00

36 lines
1.1 KiB
Lua

local sc = smart_chat
local S = sc.S
local cname = "join"
local short = "j"
local activate = minetest.settings:get_bool("smart_chat.cmd_" .. cname, true)
if(not activate) then return end
sc.register_help({
Name = cname,
Usage = "/c " .. cname .. " <channel>",
Description = S("Join or change a channel to <channel>."),
Parameter = "<channel>",
Shortcut = "/c " .. short .. " <channel>",
}
)
sc.registered_commands[cname] = function(player, parameter)
if(parameter[2] == nil or parameter[2] == "") then
sc.print(player, sc.red .. S("Error: No channel to join given."))
return
end
sc.report(player, S("Leaves the Channel."))
sc.player[player] = parameter[2]
sc.report(player, S("Enter the Channel."))
end -- sc["join"
sc.registered_commands[short] = function(player, parameter)
sc.registered_commands[cname](player, parameter)
end -- sc["j"