Solved loop-players other than the player running the command

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

  • LOOKING FOR A VERSION OF SKRIPT?

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

Status
Not open for further replies.
Hi, I'm new to skript and needed help finding the loop to detect all players around me other than me.
Around you? You mean in a radius? if yes, use
Code:
loop all players in radius <radiusHere> of player where [input is not player]:
and if you don't want the radius, just
Code:
loop all players where [input is not player]:
 
Around you? You mean in a radius? if yes, use
Code:
loop all players in radius <radiusHere> of player where [input is not player]:
and if you don't want the radius, just
Code:
loop all players where [input is not player]:
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:
command /robar:
  trigger:
    loop all players in radius 5 of player where [input is not player]:
      if player is in the region "mina":
        if loop-player is in the region "mina":
          if loop-player = 1
            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
          else:
            send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
[doublepost=1636719429,1636719041][/doublepost]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
[doublepost=1636720263][/doublepost]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)
 
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:
command /robar:
  trigger:
    loop all players in radius 5 of player where [input is not player]:
      if player is in the region "mina":
        if loop-player is in the region "mina":
          if loop-player = 1
            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
          else:
            send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
[doublepost=1636719429,1636719041][/doublepost]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
[doublepost=1636720263][/doublepost]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)
what is if loop-player = 1 supposed to be
 
what is if loop-player = 1 supposed to be
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
 
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
Code:
command /robar:
    trigger:
        if "%region at player%" contains "mina":
            loop all players in radius 5 of player where [input is not player]:
                add 1 to {_} if "%region at loop-player%" contains "mina":
            if {_} < 1:
                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."
            else:
                send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
something like that
 
Code:
command /robar:
    trigger:
        if "%region at player%" contains "mina":
            loop all players in radius 5 of player where [input is not player]:
                add 1 to {_} if "%region at loop-player%" contains "mina":
            if {_} < 1:
                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."
            else:
                send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
something like that
I keep getting an error:
"can't understand this condition: 'add 1 to {_} if region% region at loop-player% contains" mine "
 
imagen-2021-11-12-113314.png
imagen-2021-11-12-113420.png
 
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
do not change anything, in fact I copied and pasted it, I use an older version of skript
imagen-2021-11-12-122205.png

[doublepost=1636734504,1636734142][/doublepost]my server recommends me to use this version
imagen-2021-11-12-122745.png

[doublepost=1636734593][/doublepost]well, install the latest version and the error persists
[doublepost=1636735604][/doublepost]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:
command /robar:
    trigger:
        if player is in the region "mina":
            loop all players in radius 5 of player where [input is not player]:
                set {victima} to loop-player
                if loop-player is in the region "mina":
                    set {victima} to 1
            if {victima} = 1:
                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."
            else:
                send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
 
do not change anything, in fact I copied and pasted it, I use an older version of skript
imagen-2021-11-12-122205.png

[doublepost=1636734504,1636734142][/doublepost]my server recommends me to use this version
imagen-2021-11-12-122745.png

[doublepost=1636734593][/doublepost]well, install the latest version and the error persists
[doublepost=1636735604][/doublepost]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:
command /robar:
    trigger:
        if player is in the region "mina":
            loop all players in radius 5 of player where [input is not player]:
                set {victima} to loop-player
                if loop-player is in the region "mina":
                    set {victima} to 1
            if {victima} = 1:
                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."
            else:
                send "&cNo hay nadie o hay mucha gente, busca a alguien que esté solo para robarle."
why do you have 2 of the most outdated addons installed, and why are you setting the variable to loop-player then to 1
 
why do you have 2 of the most outdated addons installed, and why are you setting the variable to loop-player then to 1
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
 
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
so what you want is to only get 1 player in radius 5 of the player?
if yes, just use
Code:
first element out of all players in radius 5 of player where [input != player]
 
Status
Not open for further replies.