Please help me fix this skript, I have been trying for hours

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

gamerguy987

Member
May 22, 2021
1
0
1
21
Ok, so im making a skript based on the 3rd life smp and im having problems making a player on their last life be able to start pvp, so a player on their life 1 should be able to start pvp and other players on any life should be able to attack back for 20 seconds,but someone on their 2 and 3 life should not be able to start pvp.

This is what i have now: (This is only the damage section that i need help with)

on damage:
victim is player
attacker is player
if {lives.%attacker%} is 1:
set {can attack.%victim%} to yes
if {can attack.%victim%} is no:
cancel event
if {can attack.%victim%} is yes:
set {can attack.%victim%} to yes
wait 20 seconds
set {can attack.%victim%} to no

In this case someone on their life 1 can attack but people on their 2 and 3 life can't attack back, How do i fix this?
 
It's a very bad solution but try that
Code:
on damage of player:
  if attacker is player:
    if {lives::%attacker%} is 1:
      set {can attack::%victim%} to true
    if {canattack::%victim%} is false:
      cancel event
    if {canattack::%victim%} is true:
      set {canattack::%victim%} to true
      wait 20 seconds
      set {canattack::%victim%} to false