command /duel [<player>]:
cooldown: 1 second
trigger:
if {p::%uuid of player%::currentDuel} is not set:
if arg-1 is set:
if arg-1 is not player:
if {duels::requests::%uuid of arg-1%::%uuid of player%} is not set:
send "&c%player% &awants to duel you &8| &7/request accept &c%player% &7to accept" to arg 1
send "&7Successfully send a request to &c%arg-1%"
set {duels::requests::%uuid of arg-1%::%uuid of player%} to player
set {p::%uuid of player%::sendedRequests::%uuid of arg-1%} to arg-1
wait 1 minute
delete {duels::requests::%uuid of arg-1%::%uuid of player%},{p::%uuid of player%::sendedRequests::%uuid of arg-1%}
else:
send "You cancel your's request to %arg-1%"
send "%player% cancel request to duel with you" to arg-1
delete {duels::requests::%uuid of arg-1%::%uuid of player%},{p::%uuid of player%::sendedRequests::%uuid of arg-1%}
else:
send "&cYou cant send request to yourself"
else:
send "&cNot a valid player"
else:
send "&cYou cant send requests when duel is running"
command /request [<text>] [<player>]:
trigger:
if {p::%uuid of player%::currentDuel} is not set:
if arg 2 is not set:
send "&cNot a valid player"
else if arg 1 is set:
if arg-1 is "accept":
if {duels::requests::%uuid of player%::%uuid of arg-2%} is set:
send "&aYour's request accepted by %player%" to arg-2
delete {duels::requests::%uuid of player%::%uuid of arg-2%}
delete {p::%uuid of arg-2%::sendedRequests::%uuid of player%}
add 1 to {duels::counter}
set {duels::active::%{duels::counter}%::previousLocations::%uuid of player%} to location of player
set {duels::active::%{duels::counter}%::previousLocations::%uuid of arg-2%} to location of arg-2
set {duels::active::%{duels::counter}%::players::%uuid of player%} to arg-2
set {duels::active::%{duels::counter}%::players::%uuid of arg-2%} to player
set {duels::active::%{duels::counter}%::savedItems::%uuid of player%::*} to all items in inventory of player
set {duels::active::%{duels::counter}%::savedItems::%uuid of arg-2%::*} to all items in inventory of arg-2
set {p::%uuid of player%::currentDuel} to {duels::counter}
set {p::%uuid of arg-1%::currentDuel} to {duels::counter}
teleport arg-2 to location(-241, 94, -281, world "world")
teleport player to location(-241, 94, -241, world "world")
clear player's inventory
clear arg-2's inventory
else:
send "&cYou doesn't have requests from this player"
else if arg-1 is "deny":
if {duels::requests::%uuid of player%::%uuid of arg-2%} is set:
send "&c%player% denied your's request to duel" to arg-2
delete {duels::requests::%uuid of player%::%uuid of arg-2%}
delete {p::%uuid of arg-2%::sendedRequests::%uuid of player%}
else:
send "&cYou doesn't have requests from this player"
else:
send "&cNot a valid type"
send "&cOptions: Accept, Deny"
else:
send "&cYou cant accept requests when duel is running"
on respawn:
if {p::%uuid of player%::currentDuel} is set:
set {_duelId} to {p::%uuid of player%::currentDuel}
wait 5 ticks
teleport player to {duels::active::%{_duelId}%::previousLocations::%uuid of player%}
set {_inventory} to chest inventory with 5 rows named "&aSaved Items"
loop {duels::active::%{_duelId}%::savedItems::%uuid of player%::*}:
add loop-value to {_inventory}
open {_inventory} to player
delete {p::%uuid of player%::currentDuel}
delete {duels::active::%{_duelId}%::previousLocations::%uuid of player%}
delete {duels::active::%{_duelId}%::players::%uuid of player%}
delete {duels::active::%{_duelId}%::savedItems::%uuid of player%::*}
on death of player:
if {p::%uuid of victim%::currentDuel} is set:
set {_duelId} to {p::%uuid of victim%::currentDuel}
set {_opponent} to {duels::active::%{_duelId}%::players::%uuid of victim%}
send "&aCongrutilations, you win duel with %victim%" to {_opponent}
send "&cYou lose duel with %{_opponent}%" to victim
wait 10 seconds
teleport {_opponent} to {duels::active::%{_duelId}%::previousLocations::%uuid of {_opponent}%}
set {_inventory} to chest inventory with 5 rows named "&aSaved Items"
loop {duels::active::%{_duelId}%::savedItems::%uuid of {_opponent}%::*}:
add loop-value to {_inventory}
open {_inventory} to {_opponent}
delete {p::%uuid of {_opponent}%::currentDuel}
delete {duels::active::%{_duelId}%::previousLocations::%uuid of {_opponent}%}
delete {duels::active::%{_duelId}%::players::%uuid of {_opponent}%}
delete {duels::active::%{_duelId}%::savedItems::%uuid of {_opponent}%::*}