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.

pvp leaving

Discussion in 'Skript' started by Ter2FIc, Jul 29, 2021.

Thread Status:
Not open for further replies.
  1. Ter2FIc

    Ter2FIc Member

    Joined:
    Dec 30, 2020
    Messages:
    20
    Likes Received:
    0
    Trying to make a code that kills the player who disconnected on pvp...
    Code (Text):
    1. on damage:
    2.     set {damage.%victim%} to true
    3.     set {player'soldhealth.%victim%} to victim's health
    4.     wait 5 seconds
    5.     if {player'soldhealth.%victim%} = victim's health:
    6.         set {damage.%victim%} to false
    7.  
    8. on leave:
    9.     if {damage.%player%} is true:
    10.         set {death.%player%} to true
    11.  
    12. on join:
    13.     if {death.%player%} is true:
    14.         kill player
     
  2. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    It's not very efficient because of the every 1 second, but it does it job.. Hopefully
    Code (Text):
    1. on damage of player:
    2.     if attacker is a player:
    3.         if {combattag::%attacker%} is not set:
    4.             send "you are in combat dont log out" to attacker
    5.         if {combattag::%victim%} is not set:
    6.             send "you are in combat dont log out" to victim
    7.         set {combattag::%attacker%} to now
    8.         set {combattag::%victim%} to now
    9.        
    10.        
    11. on death of player:
    12.     if attacker is a player:
    13.         delete {combattag::%victim%}
    14.         delete {combattag::%attacker%}
    15.         send "you are no longer in combat" to attacker
    16.         send "you are no longer in combat" to victim
    17.        
    18. on quit:
    19.     if {combattag::%player%} is set:
    20.         delete {combattag::%player%}
    21.         kill player
    22.        
    23. every 1 second:
    24.     loop all players:
    25.         if {combattag::%loop-player%} is set:
    26.             if difference between now and {combattag::%loop-player%} is more than 9.9 seconds:
    27.                 delete {combattag::%loop-player%}
    28.                 send "you are no longer in combat" to loop-player
    29.                 send action bar "" to loop-player
    30.             else:
    31.                 set {_x} to difference between now and {combattag::%loop-player%}
    32.                 set {_xx} to "%{_x}%"
    33.                 replace all "seconds" with "" in {_xx}
    34.                 set {_f1::*} to split {_xx} at "."
    35.                 set {_rem} to {_f1::1} parsed as a integer
    36.                 set {_final} to 10 - {_rem}
    37.                 send action bar "you are still in the fight for %{_final}% seconds" to loop-player
     
Thread Status:
Not open for further replies.

Share This Page

Loading...