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.

Fight Timer

Discussion in 'Requests' started by Benno812, Dec 6, 2017.

  1. Benno812

    Benno812 Member

    Joined:
    Mar 1, 2017
    Messages:
    13
    Likes Received:
    0
    Hi, i'm trying to create a timer that turn on when you do or receive damage, count from 20 to 0 seconds and then turn off. If you do or receive other damage during that 20 seconds period the timer restarts. The purpose of this is to let you enter in some sort of "fight mode" in which you cannot tp, open menus etc. If 20 seconds pass without damage events you exit the fight mode.

    Code (Skript):
    1. on damage:
    2.     victim is a player:
    3.         send "&c You are in a fight" to victim
    i tried by adding a "loop 20 times" thing but didn't work as expected.
     
    #1 Benno812, Dec 6, 2017
    Last edited: Dec 6, 2017
  2. ChisleLP

    ChisleLP Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    789
    Likes Received:
    58
    Code (Skript):
    1. on damage:
    2.     victim is a player
    3.     {RageQuit::%attacker%} is not victim:
    4.         set {RageQuit::%attacker%} to victim
    5.         set {CoolDown::%attacker%} to 20      
    6.         while {CoolDown::%attacker%} is not 0:
    7.             wait a seconds
    8.             subtract 1 from {CoolDown::%attacker%}
    9.             send "CombatLog: %{CoolDown::%attacker%}%"
    10.    
     
  3. Benno812

    Benno812 Member

    Joined:
    Mar 1, 2017
    Messages:
    13
    Likes Received:
    0
    thank you but that is not working
     
  4. Selvati

    Selvati Active Member

    Joined:
    Jun 26, 2017
    Messages:
    190
    Likes Received:
    9
    So you want a pvp timer skript, so players have to wait a certain amount of time before doing certain things?
     
  5. ChisleLP

    ChisleLP Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    789
    Likes Received:
    58
    Anti combat logoout
     
  6. Benno812

    Benno812 Member

    Joined:
    Mar 1, 2017
    Messages:
    13
    Likes Received:
    0
    Yes, exactly
     
  7. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    62
    This may not be the most efficient way of doing it, but this is part of my pvp combat log skript
    Code (Skript):
    1. on damage of player:
    2.     attacker is a player
    3.     if {combat.tag::%attacker%} is false:
    4.         send "Tagged in combat for 15 seconds. Don't log out" to attacker
    5.         set {combat.tag::%attacker%} to true
    6.     if {combat.tag::%victim%} is false:
    7.         send "Tagged in combat for 15 seconds. Don't log out" to victim
    8.         set {combat.tag::%victim%} to true
    9.     wait 15 seconds
    10.     set {combat.tag::%attacker%} to false
    11.     set {combat.tag::%victim%} to false
    12.    
    13. on command:
    14.     command is equal to "spawn", "back", "tpa" or "home"
    15.     if {combat.tag::%player%} is true:
    16.         message "You can't teleport while tagged in combat"
    17.         cancel event
    18.        
    19. On quit:
    20.     if {combat.tag::%player%} is true:
    21.         kill player
    22.         broadcast "%player% was killed for combat logging."
     

Share This Page

Loading...