• Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Bob Brooklyn

Member
Dec 12, 2020
2
0
1
20
basically, I want it so when {player.1} dies, it cancels the event and teleports them to (231, 152, -195, world). right now (no error message), it cancels the event but doesn't teleport {player.1} . please help

Code:
#The duel command
command /bridgeduel <player>:
    trigger:
# putting players into variables
        clear {ingame}
        clear {player.1}
        clear {player.2}
        make player execute command "/p1"
        make arg-1 execute command "/p2"
        set {player.1} to player
        set {ingame} to player
        teleport player to location(231, 152, -195, world)
        make player execute command "/gamemode survival"
        set {player.2} to arg-1
        set {ingame} to arg-1
        set {%player%.points} to 0
        teleport arg-1 to location(231, 152, -251, world)
# setting up the kits
        clear player's inventory
        give player wooden sword
        give player 64 blue wool
        give player 3 golden apple
        give player bow
        give player 4 arrows
        make arg-1 execute command "/gamemode survival"
        clear arg-1's inventory
        give arg-1 wooden sword
        give arg-1 64 red wool
        give arg-1 3 golden apple
        give arg-1 bow
        give arg-1 4 arrows
on step on black carpet:
    if player is {player.2}:
        heal {player.1}
        heal {player.2}
        add 1 to {%player%.points}
        broadcast "%player% Has &3%{%player%.points}% Points"
        teleport {player.1} to location(231, 152, -195, world)
        teleport {player.2} to location(231, 152, -251, world)
        if {%player%.points} >= 5:
            set {%player%.points} to 0
            broadcast "&a%player% &3Now has &45 &3Points and has Won the Game!"
            send title "&2%player%" with subtitle "Has Scored 5 Points and Won the Game " for 3 seconds
        if {%player%.points} < 5:
            send title "&2%player%" with subtitle "Has Scored!" for 1 seconds
    if player is {player.1}:
        send "&4You can't score in your own goal!"
        teleport player to location(231, 152, -195, world)
on death:
    if player is {ingame}:
        cancel event
        if player is {player.1}:
            teleport player to location(231, 152, -195, world)
command /tpoop:
    trigger:
        teleport {player.1} to location(231, 152, -195, world)
on step on red mushroom block:
    heal {player.1}
    heal {player.2}
    if player is {player.1}:   
        add 1 to {%player%.points}
        broadcast "%player% Has &3%{%player%.points}% Points"

#
#    send "points set to 0"
    if {%player%.points} >= 5:
        broadcast "&a%player% &3Now has &45 &3Points and has Won the Game!"
        set {%player%.points} to 0
        broadcast "&a%player% &3Now has &45 &3Points and has Won the Game!"
        send title "&2%player%" with subtitle "Has Scored 5 Points and Won the Game " for 3 seconds
        teleport {player.1} to location(231, 152, -195, world)
        teleport {player.2} to location(231, 152, -251, world)
        clear {player.1}
        clear {player.2}
    if {%player%.points} < 5:
        send title "&2%player%" with subtitle "Has Scored!" for 3 seconds
        teleport {player.1} to location(231, 152, -195, world)
        teleport {player.2} to location(231, 152, -251, world)
#    send "points set to 0"


command /p2:   
    trigger:
        set {player.2} to player

command /p1:   
    trigger:
        set {player.1} to player
command /test:
    trigger:
        if player is {ingame}:
            send "you are {ingame}"
command /test1:
    trigger:
        if {player.1} is player:
            send "hi" to {player.1}
command /resetplayer:
    trigger:
        clear {ingame}
        clear {player.1}
        clear {player.2}
command /ingame:
    trigger:
        set {ingame} to player
command /playersingame:
    trigger:
        if player is {player.1}:
            send "you are {player.1}" to {player.1}
        if player is {player.2}:
            send "you are {player.2}" to {player.2}
 
I'd set the location to a variable using a command, teleporting the player to the variable afterwards. This would also make the location changeable in-game.

Code:
command /setloc:
    trigger:
        set {loc} to location of player

Code:
teleport arg-1 to {loc}
 
Status
Not open for further replies.