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.

Solved Need Help {in a hurry}

Discussion in 'Skript' started by melanzy, Aug 15, 2021.

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

    melanzy Member

    Joined:
    Aug 4, 2021
    Messages:
    11
    Likes Received:
    0
    Skript Version: 2.2-dev36 Minecraft Version: 1.8.9

    Code
    Code (Text):
    1. command /revive [<offlineplayer>]:
    2.   aliases: rev
    3.   trigger:
    4.    if player has permission "events.moderator":
    5.      if arg-1 is a player:
    6.        make console execute command "scoreboard teams join Dead %arg-1%"
    7.        make console execute command "scoreboard teams join Alive %arg-1%"
    8.        make console execute command "effect %arg-1% clear"
    9.        wait 1 second
    10.        teleport arg-1 to {events_spawn}
    11.        wait 2 ticks
    12.        broadcast "{@prefix} &f%arg-1% &ahas been revived!"
    13.      if {teamcount::*} doesn't contain arg-1:
    14.        add arg-1 to {teamcount::*}
    15.        stop

    What doesn't work
    Code (Text):
    1.  if {teamcount::*} doesn't contain arg-1:
    2.    add arg-1 to {teamcount::*}
    3.    stop

    I want to make so if i issue the command twice, if the player is already in the list, it doesn't add him back again

    no errors: console + ingame

    Boosting

     
    #1 melanzy, Aug 15, 2021
    Last edited: Aug 15, 2021
  2. Best Answer:
    Post #5 by Minecoll_YT, Aug 16, 2021
  3. Crocie

    Crocie Member

    Joined:
    Jul 2, 2021
    Messages:
    29
    Likes Received:
    0
    Im not sure if the condition will work, but i think u need to put "else if"

    Try

    Code (Text):
    1. else if {teamcount::*} doesn't contain arg-1:
    2.    add arg-1 to {teamcount::*}
    3.    stop
     
  4. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    Nop


    But I don't really get what are you trying to do? Please provide a proper description.
    And this check is useless, it just adds the player and then stops.
    Code (Text):
    1.      if {teamcount::*} doesn't contain arg-1:
    2.        add arg-1 to {teamcount::*}
    3.        stop
     
  5. melanzy

    melanzy Member

    Joined:
    Aug 4, 2021
    Messages:
    11
    Likes Received:
    0
    I am trying to prevent adding the player twice, if i do the command it checks if he's already in {teamcount::*}, and if he is it doesn't add him again, else if he isn't it does add him
     
  6. Minecoll_YT

    Supporter Forums Helper

    Joined:
    Dec 2, 2018
    Messages:
    650
    Likes Received:
    39
    Switched to discord - Solution:
    Code (Text):
    1. command /revive [<offlineplayer>]:
    2.     aliases: rev
    3.     trigger:
    4.         if player has permission "events.moderator":
    5.             if arg-1 is a player:
    6.                 if "%{teamcount::*}%" contains "%arg-1%"
    7.                     add arg-1 to {teamcount::*}
    8.                     make console execute command "scoreboard teams join Dead %arg-1%"
    9.                     make console execute command "scoreboard teams join Alive %arg-1%"
    10.                     make console execute command "effect %arg-1% clear"
    11.                     teleport arg-1 to {events_spawn}
    12.                     broadcast "{@prefix} &f%arg-1% &ahas been revived!"
     
Thread Status:
Not open for further replies.

Share This Page

Loading...