How do i know if a player is in a list?

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

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

AQika

Member
Jun 28, 2023
31
3
8
im trying to make a tag minigame, i just started and i have a dillema


Code:
on damage:
    if {tag_ongoing} is true:
        if attacker is {_it}:
            remove attacker from {_it}
            add victim to {_it}
            clear attacker's inventory
            give victim barrier named "&c&lIT barrier"
            broadcast "&c&l%{_it}% is it"

i dont know how to detect if a player is in {_it} i would love some help.
 
you're checking if an unset variable is something in this condition: 'if attacker is {_it}'
you may say why is it unset? it's because it's a local variable, not global

ok so let's move on on how to check if a player is IT
you have to set a global variable to the IT whenever you start the game, i have no clue when you start it, but you should that
and then, in a damage event you check if the tag game is ongoing, and now it's when you check if attacker is IT
basically.. if attacker is x... but make sure to replace x with your global variable
now we have checked if they're IT, we don't remove/add players from the it variable, cause it's not a list variable, so we set the global variable to the victim
rest of the code is fine, but replace the local variable with the global
 
you're checking if an unset variable is something in this condition: 'if attacker is {_it}'
you may say why is it unset? it's because it's a local variable, not global

ok so let's move on on how to check if a player is IT
you have to set a global variable to the IT whenever you start the game, i have no clue when you start it, but you should that
and then, in a damage event you check if the tag game is ongoing, and now it's when you check if attacker is IT
basically.. if attacker is x... but make sure to replace x with your global variable
now we have checked if they're IT, we don't remove/add players from the it variable, cause it's not a list variable, so we set the global variable to the victim
rest of the code is fine, but replace the local variable with the global
Thanks, im new to skript and i forgot _ makes a local variable, this worked for me