Solved Teleport on death event instead of dying.

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

Jerooski

Member
Apr 19, 2020
16
0
0
25
I've got this so far, but the victim is not teleported back to spawn. It just cancels the death event and can keep on "dying".

Code:
on death:
  attacker is a player
  if victim is a player:
    cancel event
    add 15 to the attacker's account
    teleport victim to location at (25, 98, 5) in world "Main"
    broadcast "&c&lPVP &7» &c%attacker% &7killed &c%victim% &7and got &a&l+15$"
 
I recommend you to set the location in a variable, it works for me.
Code:
command /setspawn [<text>]:
    permission: *.*
    permission message: &cYou don't have permission.
    executably by: players
    trigger:
        if arg-1 is not set:
            set {spawn.mainworld} to player's location
            send "&aSpawn set at &f%{spawn.mainworld}%&a!"
        else:
            set {spawn.mainworld} to player's location
            send "&aSpawn set at &f%{spawn.mainworld}%&a!"

on death of a player:
    if attacker is a player:
        if victim is a player:
            force victim to respawn
            add 15 to attacker's balance
            
            wait 1 tick

            teleport victim to {spawn.mainworld}
            broadcast "&c&lPVP &7» &c%attacker% &7killed &c%victim% &7and got &a&l+15$"
 
Use this instead
Code:
on damage of player:
    if damage is greater than victim's health:
        # do stuff
 
Status
Not open for further replies.