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 loop-players other than the player running the command

Discussion in 'Skript' started by Gabrriel Nicolas, Nov 11, 2021.

Thread Status:
Not open for further replies.
  1. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
    Hi, I'm new to skript and needed help finding the loop to detect all players around me other than me.
     
  2. yea rite

    yea rite Active Member

    Joined:
    Jul 11, 2021
    Messages:
    73
    Likes Received:
    5
    Code (Text):
    1. command: /loop
    2.   trigger:
    3.     loop all players:
    4.       if loop-player is player:
    5.         stop
    6.       if loop-player is not player:
    7.         stuff
     
  3. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    Around you? You mean in a radius? if yes, use
    Code (Text):
    1. loop all players in radius <radiusHere> of player where [input is not player]:
    and if you don't want the radius, just
    Code (Text):
    1. loop all players where [input is not player]:
     
  4. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
    Thank you helped me a lot, I am making a code but I still get errors, could you help me see what is wrong?
    Code (Text):
    1.  
    2. command /robar:
    3.   trigger:
    4.     loop all players in radius 5 of player where [input is not player]:
    5.       if player is in the region "mina":
    6.         if loop-player is in the region "mina":
    7.           if loop-player = 1
    8.             send "&cEntraste en el &7Modo Ladrón&c. &cSelecciona que quieres hacer a tu víctima, pero &c&LTEN CUIDADO &c&lLA POLICIA FUE ALERTADA." to player
    9.           else:
    10.             send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
    --- Double Post Merged, Nov 12, 2021, Original Post Date: Nov 12, 2021 ---
    Basically, what I want to do is detect if in a specific region 5 blocks away from the player executing the command there is only one player other than the one executing it, if the player is in the region "mina" and there is only one player near him, is run the code
    --- Double Post Merged, Nov 12, 2021 ---
    I forgot to say that the imput is a player, nothing but him is the one that executes it, I want the loop players to detect everyone except him (sorry my bad english btw)
     
  5. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    what is if loop-player = 1 supposed to be
     
  6. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
    sorry, I just wanted to explain what I wanted to do, the "loop-player = 1" would have the function of only detecting ONE player around 5 blocks, also, as I am very new to script, I get a lot of "tab" errors and from "spaces" I don't know how many tabs or how many spaces I should use in that code
     
  7. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    Code (Text):
    1. command /robar:
    2.     trigger:
    3.         if "%region at player%" contains "mina":
    4.             loop all players in radius 5 of player where [input is not player]:
    5.                 add 1 to {_} if "%region at loop-player%" contains "mina":
    6.             if {_} < 1:
    7.                 send "&cEntraste en el &7Modo Ladrón&c. &cSelecciona que quieres hacer a tu víctima, pero &c&LTEN CUIDADO &c&lLA POLICIA FUE ALERTADA."
    8.             else:
    9.                 send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
    something like that
     
  8. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
    I keep getting an error:
    "can't understand this condition: 'add 1 to {_} if region% region at loop-player% contains" mine "
     
  9. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    did you change the line? because that's not how mine looks, send a ss
     
  10. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
  11. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    the quotes seem to be changed in game, they seem to be fancy quotes, did you change them or is that just how it looks in game? also what your skript-version
     
  12. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
    do not change anything, in fact I copied and pasted it, I use an older version of skript[​IMG]
    --- Double Post Merged, Nov 12, 2021, Original Post Date: Nov 12, 2021 ---
    my server recommends me to use this version[​IMG]
    --- Double Post Merged, Nov 12, 2021 ---
    well, install the latest version and the error persists
    --- Double Post Merged, Nov 12, 2021 ---
    I'm back, doing some things I was able to fix the code but now it gives me space and tab errors, I guess it's a syntax error (I repeat, I'm new) can you help me?
    Code (Text):
    1.  
    2. command /robar:
    3.     trigger:
    4.         if player is in the region "mina":
    5.             loop all players in radius 5 of player where [input is not player]:
    6.                 set {victima} to loop-player
    7.                 if loop-player is in the region "mina":
    8.                     set {victima} to 1
    9.             if {victima} = 1:
    10.                 send "&cEntraste en el &7Modo Ladrón&c. &cSelecciona que quieres hacer a tu víctima, pero &c&LTEN CUIDADO &c&lLA POLICIA FUE ALERTADA."
    11.             else:
    12.                 send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
     
  13. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    why do you have 2 of the most outdated addons installed, and why are you setting the variable to loop-player then to 1
     
  14. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
    I don't use any of those addons, I forgot to delete them, and I put "set loop-player = 1", since according to my knowledge in scoreboards they will continue adding numbers to loop player and there is nothing to stop it in That code, I wanted to make it only detect 1 player around 5 blocks, not how many can add loop-player
     
  15. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    so what you want is to only get 1 player in radius 5 of the player?
    if yes, just use
    Code (Text):
    1. first element out of all players in radius 5 of player where [input != player]
     
  16. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
    thanks, solved, but I have more doubts about skript, do I do it in this same thread or create another?
     
  17. oToghty

    VIP Supporter +

    Joined:
    Sep 1, 2020
    Messages:
    143
    Likes Received:
    5
    you can ask here, or better yet, just join a discord server such as skunity where you can get help very quickly
     
  18. Gabrriel Nicolas

    Joined:
    Nov 11, 2021
    Messages:
    13
    Likes Received:
    0
    thanks i will join discord, you can mark this thread as solved :emoji_slight_smile:
     
  19. yea rite

    yea rite Active Member

    Joined:
    Jul 11, 2021
    Messages:
    73
    Likes Received:
    5
    isnt that something you have to do?
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...