-
Notifications
You must be signed in to change notification settings - Fork 2
/
cmd_join.lua
45 lines (33 loc) · 1.29 KB
/
cmd_join.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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(sc.join_with_priv) then
local power = sc.is_channeluser(player)
if(power < 5) then
sc.print(player,sc.orange .. S("You have not the power to join channels."))
return
end
end
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"