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 How to loop all players at the same time?

Discussion in 'Skript' started by FishRekt, Jun 22, 2017.

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

    FishRekt Active Member

    Joined:
    Jan 26, 2017
    Messages:
    87
    Likes Received:
    0
    Hi guys. I'm ""new"" at scripting, and i'm here because i need help. I made a speedrun skript, where the players, with a command, are teleported in a location. The problem is that the "loop all players" doesn't work at the same time, because it teleports all players one by one, doing the trigger of a command one player by one. Here's the command line:

    command /speedrun [<text>] [<text>]:
    permission: sr.admin
    permission message: &cYou don't have enough permissions for that!
    description: speedrun plugin made by LoryWasHere
    trigger:
    if arg-1 is "forcestart":
    loop all players:
    teleport loop-player to {lol}
    send "&9SpeedRun>&7 SpeedRun scripted by LoryWasHere has started!" to loop-player
    set block at {location1} to fence
    set block at {location2} to fence
    set block at {location3} to fence
    set block at {location4} to fence
    set block at {location5} to fence
    wait 2 seconds
    play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
    send "&9SpeedRun>&a The game will start soon: 5" to loop-player
    wait 1 second
    play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
    send "&9SpeedRun>&a The game will start soon: 4" to loop-player
    wait 1 second
    play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
    send "&9SpeedRun>&a The game will start soon: 3" to loop-player
    wait 1 second
    play sound "NOTE_PLING" to loop-player with volume 1 and pitch 1.5
    send "&9SpeedRun>&a The game will start soon: 2" to loop-player
    wait 1 second
    play sound "NOTE_PLING" to loop-player with volume 1 and pitch 1
    send "&9SpeedRun>&a The game will start soon: 1" to loop-player
    wait 1 second
    play sound "LEVEL_UP" to loop-player with volume 1 and pitch 1
    send "&9SpeedRun>&a The game has just started! ENJOY!" to loop-player
    set block at {location1} to air
    set block at {location2} to air
    set block at {location3} to air
    set block at {location4} to air
    set block at {location5} to air
    apply speed 10 to loop-player for 999 days
    if arg-1 is "set":
    if arg-2 is "location":
    set {lol} to executor's location
    send "&9SpeedRun>&7 You gave to players a new location to spawn!" to executor
    if arg-1 is "delete":
    loop all players:
    delete {sr.gamestarted.%loop-player%}
    delete {srjoinable}
    send "&9SpeedRun>&7 You have delete successfully the player's location and the database!" to executor

    The command is "forcestart". Please help me.
     
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    214
    First of all, remove the bold font from the thread, it just hurts my eyes so hard. And for code, you should use codeblocks, like this:

    [CODE]Your code here, as you can see[/CODE]

    And it'll be showed as:
    Code (Text):
    1. Your code here, as you can see
     
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    214
    Okay, then you have a fix for this?

    I'll put now the code:

    Code (Text):
    1.  
    2. command /speedrun [<text>] [<text>]:
    3.     permission: sr.admin
    4.     permission message: &cYou don't have enough permissions for that!
    5.     description: speedrun plugin made by LoryWasHere
    6.     trigger:
    7.         if arg-1 is "forcestart":
    8.             loop all players:
    9.                 teleport loop-player to {lol}
    10.                 send "&9SpeedRun>&7 SpeedRun scripted by LoryWasHere has started!" to loop-player
    11.                 set block at {location1} to fence
    12.                 set block at {location2} to fence
    13.                 set block at {location3} to fence
    14.                 set block at {location4} to fence
    15.                 set block at {location5} to fence
    16.                 wait 2 seconds
    17.                 play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
    18.                 send "&9SpeedRun>&a The game will start soon: 5" to loop-player
    19.                 wait 1 second
    20.                 play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
    21.                 send "&9SpeedRun>&a The game will start soon: 4" to loop-player
    22.                 wait 1 second
    23.                 play sound "NOTE_PLING" to loop-player with volume 1 and pitch 2
    24.                 send "&9SpeedRun>&a The game will start soon: 3" to loop-player
    25.                 wait 1 second
    26.                 play sound "NOTE_PLING" to loop-player with volume 1 and pitch 1.5
    27.                 send "&9SpeedRun>&a The game will start soon: 2" to loop-player
    28.                 wait 1 second
    29.                 play sound "NOTE_PLING" to loop-player with volume 1 and pitch 1
    30.                 send "&9SpeedRun>&a The game will start soon: 1" to loop-player
    31.                 wait 1 second
    32.                 play sound "LEVEL_UP" to loop-player with volume 1 and pitch 1
    33.                 send "&9SpeedRun>&a The game has just started! ENJOY!" to loop-player
    34.                 set block at {location1} to air
    35.                 set block at {location2} to air
    36.                 set block at {location3} to air
    37.                 set block at {location4} to air
    38.                 set block at {location5} to air
    39.                 apply speed 10 to loop-player for 999 days
    40.         if arg-1 is "set":
    41.             if arg-2 is "location":
    42.                 set {lol} to executor's location
    43.                 send "&9SpeedRun>&7 You gave to players a new location to spawn!" to executor
    44.         if arg-1 is "delete":
    45.             loop all players:
    46.                 delete {sr.gamestarted.%loop-player%}
    47.                 delete {srjoinable}
    48.             send "&9SpeedRun>&7 You have delete successfully the player's location and the database!" to executor
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    214
    You can try this:

    Code (Skript):
    1. command speedrun [<text>] [<text>]:
    2.     permission: sr.admin
    3.     permission message: <light red>You don't have enough permissions for that!
    4.     description: speedrun script made by LoryWasHere #it's a script, not a plugin. Remember that.
    5.     trigger:
    6.         if arg-1 is "forcestart":
    7.             teleport all players to {lol}
    8.             send "<light blue>SpeedRun><grey> SpeedRun has started!" to all players
    9.             loop 4 times:
    10.                 set block at {location%loop-num%} to fence
    11.             wait 2 seconds
    12.             loop 5 times:
    13.                 send "<light blue>SpeedRun><light green> The game will start soon: %6 - loop-num%" to all players
    14.                 play sound "NOTE_PLING" to all players with volume 1 and pitch 2
    15.                 wait 1 second
    16.         play sound "LEVEL_UP" to all players with volume 1 and pitch 1
    17.         send "<light blue>SpeedRun><light green> The game has just started! ENJOY!" to all players
    18.         loop 5 times:
    19.             set block at {location%loop-num%} to air
    20.         apply speed to all players for 99 days
    21.      
    22.  

    I know I'm spoonfeeding him but as he already had a base.
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,185
    Likes Received:
    214
    Thank you bro, this worked so much good! You're the best
     
    • Like Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...