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!

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

AntiLogout

Discussion in 'Requests' started by witld, Jul 31, 2020.

Tags:
  1. witld

    witld Member

    Joined:
    Apr 24, 2020
    Messages:
    5
    Likes Received:
    0
    Category:
    Combat
    Suggested name:
    AntiLogout
    Spigot/Skript Version:
    1.16.1 PaperMC Newest
    What I want:
    AntiLogout - When you start fightning with other players you can't leave for 30 seconds. When you leave during this time, when you log again you will be killed automatically. I also want the timer to be shown somewhere.
    Ideas for commands:
    None
    Ideas for permissions:
    None
    When I'd like it by: A reasonable time
     
  2. Potato

    Potato Well-Known Member

    Joined:
    Feb 24, 2020
    Messages:
    57
    Likes Received:
    0
    I've only tested this skript in 1.8.x, but it should work in 1.16. Enjoy.


    Code (Text):
    1. on damage of player:
    2.   if attacker is a player:
    3.     if {combat.%attacker%} is not set:
    4.       send "&c&lPVP &7» You are now in &cCOMBAT&7, don't log out!" to attacker and victim
    5.     set {combat.%attacker%} to true
    6.     set {combat.%victim%} to true
    7.     set {combat.%attacker%.lastHit} to now
    8.     wait 30 seconds
    9.     if {pvplog.%attacker%.lastHit} was more than 29.9 seconds ago:
    10.       send "&c&lPVP &7» &7You are no longer in &cCOMBAT&7." to attacker and victim
    11.       delete {combat.%attacker%}
    12.       delete {combat.%victim%}
    13.       delete {combat.%attacker%.lastHit}
    14.  
    15. on quit:
    16.   if {combat.%player%} is true:
    17.     broadcast "&c&lPVP &7» &c%player% &7Combat Logged, and got killed!"
    18.     Kill player
    19.     set {pvp.logger.%player%} to true
    20.  
    21.  
    22. on join:
    23.   if {pvp.logger.%player%} is true:
    24.     delete {pvp.logger.%player%}
     
  3. witld

    witld Member

    Joined:
    Apr 24, 2020
    Messages:
    5
    Likes Received:
    0
    Hello! Thank for the reply but when I leave and join again even without fightning I still get killed.
     
Loading...