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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

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

is there a way to check the player's team in an if statement without any skript plugins?

Discussion in 'Skript' started by UltroGmr, Sep 16, 2021.

Thread Status:
Not open for further replies.
  1. UltroGmr

    UltroGmr Member

    Joined:
    Sep 11, 2021
    Messages:
    1
    Likes Received:
    0
    i'm making a capture the flag kind of minigame and i want to make it so that you can be killed if you arent on your teams side, i think i got everything else working but how do i check the player's team or is there an alternative?
     
  2. WoolBoy

    WoolBoy Member

    Joined:
    Sep 16, 2021
    Messages:
    1
    Likes Received:
    0
    You can use the On Damage: Event to check when an entity takes damage, and then use victim is a player to make sure that the entity is a player...

    As for setting the player's team, you can make a variable like
    {%player%.team}, then assign the team of a player with:
    set {%player%.team} to *the team you want them to be on*

    Finally you can check the team on the damage event with
    {%victim%.team} is {%attacker%.team}, and then run the cancel event effect to stop the damage!
     
  3. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    142
    Likes Received:
    5
    You have the right idee in mind but it's executed very poorly
     
    • Agree Agree x 1
  4. Tenfont

    Tenfont Member

    Joined:
    Mar 28, 2021
    Messages:
    10
    Likes Received:
    2
    Those variables though...

    1. Do not start off your variables with expressions.
    2. Do not use nested variables. Use list variables instead. (https://skripthub.net/tutorials/43)

    Code (Text):
    1. {%player%.team} -> {team::%player%}
     
    • Like Like x 2
Thread Status:
Not open for further replies.

Share This Page

Loading...