AntiLogout

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

witld

New Member
Apr 24, 2020
7
0
1
25
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
 
I've only tested this skript in 1.8.x, but it should work in 1.16. Enjoy.


Code:
on damage of player:
  if attacker is a player:
    if {combat.%attacker%} is not set:
      send "&c&lPVP &7» You are now in &cCOMBAT&7, don't log out!" to attacker and victim
    set {combat.%attacker%} to true
    set {combat.%victim%} to true
    set {combat.%attacker%.lastHit} to now
    wait 30 seconds
    if {pvplog.%attacker%.lastHit} was more than 29.9 seconds ago:
      send "&c&lPVP &7» &7You are no longer in &cCOMBAT&7." to attacker and victim
      delete {combat.%attacker%}
      delete {combat.%victim%}
      delete {combat.%attacker%.lastHit}

on quit:
  if {combat.%player%} is true:
    broadcast "&c&lPVP &7» &c%player% &7Combat Logged, and got killed!"
    Kill player
    set {pvp.logger.%player%} to true


on join:
  if {pvp.logger.%player%} is true:
    delete {pvp.logger.%player%}
 
Hello! Thank for the reply but when I leave and join again even without fightning I still get killed.
I've only tested this skript in 1.8.x, but it should work in 1.16. Enjoy.


Code:
on damage of player:
  if attacker is a player:
    if {combat.%attacker%} is not set:
      send "&c&lPVP &7» You are now in &cCOMBAT&7, don't log out!" to attacker and victim
    set {combat.%attacker%} to true
    set {combat.%victim%} to true
    set {combat.%attacker%.lastHit} to now
    wait 30 seconds
    if {pvplog.%attacker%.lastHit} was more than 29.9 seconds ago:
      send "&c&lPVP &7» &7You are no longer in &cCOMBAT&7." to attacker and victim
      delete {combat.%attacker%}
      delete {combat.%victim%}
      delete {combat.%attacker%.lastHit}

on quit:
  if {combat.%player%} is true:
    broadcast "&c&lPVP &7» &c%player% &7Combat Logged, and got killed!"
    Kill player
    set {pvp.logger.%player%} to true


on join:
  if {pvp.logger.%player%} is true:
    delete {pvp.logger.%player%}