#Duels Leave (Help)

1 messages · Page 1 of 1 (latest)

celest nexus
#

No

knotty vine
#

cant you just use on quit?

#

like for example

#

on quit:
set {whateverthefuck%Whatever%} to whatever

tranquil wharf
#

Yeah

#

Just on quit

#

Check if they are in a duel

#

Then make them win

rare breach
#

The problem is

#

I Cant detect the player who stayed

odd star
#

Send the code you have

rare breach
#
    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

grave furnace
#

How do you start the duel? What information do you keep track of

rare breach
#
    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

rare breach
#

@grave furnace @odd star ?

grave furnace
#

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

rare breach
#

but if I put them in a list other players in different maps will get teleported too

#

@grave furnace

grave furnace
#

You misunderstand
a new list to keep track of that duel only

#

Not in a list you already have somewhere

rare breach
#

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

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

rare breach
#

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

grave furnace
#

why would you use a local variable

rare breach
#

even if I use global variable