1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Teleport on death event instead of dying.

Discussion in 'Skript' started by Jerooski, Apr 21, 2020.

Tags:
Thread Status:
Not open for further replies.
  1. Jerooski

    Jerooski Member

    Joined:
    Apr 19, 2020
    Messages:
    16
    Likes Received:
    0
    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 (Text):
    1. on death:
    2.   attacker is a player
    3.   if victim is a player:
    4.     cancel event
    5.     add 15 to the attacker's account
    6.     teleport victim to location at (25, 98, 5) in world "Main"
    7.     broadcast "&c&lPVP &7» &c%attacker% &7killed &c%victim% &7and got &a&l+15$"
     
  2. Dave

    Dave Active Member

    Joined:
    Jul 20, 2018
    Messages:
    228
    Likes Received:
    9
    I recommend you to set the location in a variable, it works for me.
    Code (Text):
    1. command /setspawn [<text>]:
    2.     permission: *.*
    3.     permission message: &cYou don't have permission.
    4.     executably by: players
    5.     trigger:
    6.         if arg-1 is not set:
    7.             set {spawn.mainworld} to player's location
    8.             send "&aSpawn set at &f%{spawn.mainworld}%&a!"
    9.         else:
    10.             set {spawn.mainworld} to player's location
    11.             send "&aSpawn set at &f%{spawn.mainworld}%&a!"
    12.  
    13. on death of a player:
    14.     if attacker is a player:
    15.         if victim is a player:
    16.             force victim to respawn
    17.             add 15 to attacker's balance
    18.            
    19.             wait 1 tick
    20.  
    21.             teleport victim to {spawn.mainworld}
    22.             broadcast "&c&lPVP &7» &c%attacker% &7killed &c%victim% &7and got &a&l+15$"
     
  3. Jerooski

    Jerooski Member

    Joined:
    Apr 19, 2020
    Messages:
    16
    Likes Received:
    0
    It works,but still shows the player deathscreen :emoji_frowning:
     
  4. Dave

    Dave Active Member

    Joined:
    Jul 20, 2018
    Messages:
    228
    Likes Received:
    9
    use skellet for ''force victim to respawn''
     
  5. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    Use this instead
    Code (Text):
    1. on damage of player:
    2.     if damage is greater than victim's health:
    3.         # do stuff
     
Thread Status:
Not open for further replies.

Share This Page

Loading...