-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchatcommands.lua
42 lines (38 loc) · 1.07 KB
/
chatcommands.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
minetest.register_chatcommand("duel", {
params = "<player name>",
description = "Challenge a player to a duel",
func = function(caller, param)
if caller == param then
return false, "You can't have a duel with yourself"
end
local player = minetest.get_player_by_name(param)
if not player then
return false, "Player:"..param.." not found."
end
if duel.challenge(caller, param) then
return true, "You have challenged "..param.." to a duel"
else
return false, "Duel already in progres"
end
end,
})
minetest.register_chatcommand("duel_accept", {
description = "Accept a duel",
func = function(caller, param)
if duel.accept(caller) then
return true, "You have accepted the challenge"
else
return false, "No-one has challenged you to a duel"
end
end,
})
minetest.register_chatcommand("duel_abandon", {
description = "Abandon a duel before one of the players dies (causes you to lose)",
func = function(caller, param)
if duel.lose(caller) then
return true, "You have abandon a duel"
else
return false, "You are not in a duel"
end
end,
})