#Duels Leave (Help)
1 messages · Page 1 of 1 (latest)
cant you just use on quit?
like for example
on quit:
set {whateverthefuck%Whatever%} to whatever
Send the code you have
if world of player is "Duels":
EndDuel(player, {_player})
function EndDuel(winner: player, loser: player):
message " " to {_loser} and {_winner}
message "&a%{_winner}% Won the fight" to {_winner}
message "&c%{_winner}% Won the fight" to {_loser}
play sound "entity.experience_orb.pickup" to {_loser} and {_winner}
clear {_loser}'s inventory
clear {_winner}'s inventory
set food level of {_loser} to 10
set food level of {_winner} to 10
reset saturation of {_loser} and {_winner}
wait 1 tick
set saturation of {_loser} and {_winner} to 5
remove speed, regeneration, strength, absorption and slow falling from {_loser} and {_winner}
heal {_loser} and {_winner}
set {nopvp.%{_loser}%} to 1
set {nopvp.%{_winner}%} to 1
set {nohunger.%{_loser}%} to true
set {nohunger.%{_winner}%} to true
wait 5 seconds
teleport {_loser} to {duelshub}
teleport {_winner} to {duelshub}```
*ignore all of the code below line 5
How do you start the duel? What information do you keep track of
if {queuePlayerSword} is set:
MapTeleport({_player}, {queuePlayerSword})
clear {queuePlayerSword}'s inventory
send "&aDuel has started" to {_player} and {queuePlayerSword}
wait 1 tick
play sound "entity.experience_orb.pickup" to {queuePlayerSword} and {_player}
delete {nopvp.%{_player}%}
delete {nopvp.%{queuePlayerSword}%}
delete {queuePlayerSword}
delete {queueCheckSword.%{queuePlayerSword}%}
else:
wait 1 tick
message "&aYou joined the queue" to {_player}
set slot 4 of {_player} to barrier named "&cLeave Queue &7(Right Click)"
set {queuePlayerSword} to {_player}
set {queueCheckSword.%{_player}%} to {_player}```
the duel starts when there are 2 players in the queue
@grave furnace @odd star ?
ok, so just put both players in a list variable together, can be based on a duel id you make up
or you can also assign each other as the other's opponent in a variable
so you can can who is in duel with who
but if I put them in a list other players in different maps will get teleported too
@grave furnace
You misunderstand
a new list to keep track of that duel only
Not in a list you already have somewhere
but how? where can I put it?
if I put set {_players::*} in the function queueSword each time 2 players will join a different map and it will add all of them to the list
@grave furnace
where can I put it?
Make a new list
A new list only for that duel instance, not for all duels
Unique only for this one duel
ok but I if put this "set {_players::*} to {_player1} and {_player2}" in a function how can I use this variable in quit event? @grave furnace
sorry for tagging you too many times
why would you use a local variable
even if I use global variable