Deathswap skript help

  • 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.

Allan Noyd

Member
Apr 29, 2021
48
0
6
23
Me and my sister (helping to test) keep falling under bedrock (no damage taken from void) upon swapping locations. Around Y=-100000 the server goes down and on restart we find ourselves on the right spots.
Anyone can spot an error?

Code:

command /deathswap <text> <player>:
permission: op
permission message: "<red>You're not OP. Ask OPs for rank or use server console to get it (or suck my pp)"
trigger:
if argument-text is "start":
set {DS.ON.BOOL} to true #This boolean variable determines whether or not is the Deathswap running
set {DS.1P} to sender #This variable determines the 1st player mainly for death event later on
set {DS.2P} to argument-player #This variable determines the 2nd mainly for death event later on
loop all players:
loop-player is {DS.1P}
send title "<purple> Deathswap has started" with subtitle "<red>Last standing wins" to player for 2 seconds with fadein 1 second and fade out 1 second
set {DS.TCD} to 300 #Variable to hold time countdown. 300/60 seconds= 5 minutes. This can be tweaked by adjusting the value
while {DS.TCD} > 0:
wait 1 second
subtract 1 from {DS.TCD}
if {DS.TCD} = 5:
send subtitle "<red>5 seconds left" #Notification about remaining time
if {DS.TCD} = 0:
set {DS.2P.LOC} to location of argument-player
teleport argument-player to sender
teleport sender to {DS.2P.LOC}
while {DS.ON.BOOL} is true:
set {DS.TCD} to 300 #The countdown will reset until someone of the two players dies
else if argument-text is "stop":
set {DS.ON.BOOL} to false
loop all players:
loop-player is {DS.1P}
send title "<orange> Deathswap was cancelled" with subtitle "<yellow>Noone won" to loop-player for 2 seconds with fadein 1 second and fade out 1 second
loop all players:
loop-player is {DS.2P}
send title "<orange> Deathswap was cancelled" with subtitle "<yellow>Noone won" to loop-player for 2 seconds with fadein 1 second and fade out 1 second
delete {DS.1P}
delete {DS.2P}
else:
send "<red>Can't understand argument text. Options are <orange>start <red>or <orange>stop"

on death:
if event-player is {DS.1P}:
send title "<lime>You Won!" to {DS.2P}
send title "<red>You Lost!" to {DS.1P}
set {DS.ON.BOOL} to false #So it will end, when one dies
else if event-player is {DS.2P}:
send title "<red>You Lost!" to {DS.2P}
send title "<lime>You Won!" to {DS.1P}
set {DS.ON.BOOL} to false
 
Status
Not open for further replies.