How can i repeat a loop after if?

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

entwickeln

Member
May 11, 2022
40
0
6
21
loop all players:
set {_player} to random element of all players
if player is "Shroush" or "TestPerson21":
repeat loop <--- how can i make this repeat the thing again when someone is called like this?

pls help
 
="entwickeln, post: 62205, member: 22797"]i want to loop the first loop again
What are you trying to do because it doesn't make any sense. If you tell us we can tell you a way to accomplish what you're trying to do.
Because it doesn't make any sense to loop all players and then set {_player} to a random element out of players. Because if you are using a command to find a random player or a event you can just set {_player} to a random element out of players whidout the need to loop all players. Why do you want to choose a player and then repeat the loop again?
This is what I think too are trying to do
Code:
Function FindPlayer():
    Set {_player} to a random element of all players
    If {_player} is "player1" or "player2":
        #code if you find the player
    Else:
        Findplayer()#repeat loop again 
        Wait a tick#or the server will probably crash


Command /randomplayer:
    Trigger:
        FindPlayer()
 
What are you trying to do because it doesn't make any sense. If you tell us we can tell you a way to accomplish what you're trying to do.
Because it doesn't make any sense to loop all players and then set {_player} to a random element out of players. Because if you are using a command to find a random player or a event you can just set {_player} to a random element out of players whidout the need to loop all players. Why do you want to choose a player and then repeat the loop again?
This is what I think too are trying to do
Code:
Function FindPlayer():
    Set {_player} to a random element of all players
    If {_player} is "player1" or "player2":
        #code if you find the player
    Else:
        Findplayer()#repeat loop again
        Wait a tick#or the server will probably crash


Command /randomplayer:
    Trigger:
        FindPlayer()
It's the thing i searched BUT i i get an error, it's says that he can't understand "function findplayer():
Do i need an Addon for this?
[doublepost=1653418442,1653415984][/doublepost]
What are you trying to do because it doesn't make any sense. If you tell us we can tell you a way to accomplish what you're trying to do.
Because it doesn't make any sense to loop all players and then set {_player} to a random element out of players. Because if you are using a command to find a random player or a event you can just set {_player} to a random element out of players whidout the need to loop all players. Why do you want to choose a player and then repeat the loop again?
This is what I think too are trying to do
Code:
Function FindPlayer():
    Set {_player} to a random element of all players
    If {_player} is "player1" or "player2":
        #code if you find the player
    Else:
        Findplayer()#repeat loop again
        Wait a tick#or the server will probably crash


Command /randomplayer:
    Trigger:
        FindPlayer()
What do i have to write in the ()?
 
It's the thing i searched BUT i i get an error, it's says that he can't understand "function findplayer():
Do i need an Addon for this?
[doublepost=1653418442,1653415984][/doublepost]
What do i have to write in the ()?
You don't need addons and is not necessary to have values inside () but there is a tutorial about function in this page.
But you can try adding this (s: string)
Then when you call the function
FindPlayer("ASDS")
 
You don't need addons and is not necessary to have values inside () but there is a tutorial about function in this page.
But you can try adding this (s: string)
Then when you call the function
FindPlayer("ASDS")
not working, it's says the skript can't understand..
 
Status
Not open for further replies.