10 player joins

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

    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!

BAWYS14

Member
Jun 28, 2024
2
0
1
on 10 newjoin player:
wait 5 ticks
excute /titel 10 new players reached keyall-
/keyall small
 
you can try something like


Code:
on load:
   set {_playersJoined} to 0

on join:
    add 1 to {_playersJoined}
    if {_playersJoined} is 10:
        execute console command "/keyall small"
        set {_playersJoined} to 0

im not the best at skript so it might not work tho
 
you can try something like


Code:
on load:
   set {_playersJoined} to 0

on join:
    add 1 to {_playersJoined}
    if {_playersJoined} is 10:
        execute console command "/keyall small"
        set {_playersJoined} to 0

im not the best at skript so it might not work tho
There's a couple reasons that wouldn't work. For one, the type of variable you're using wouldn't save. If it has an underscore before, the value is reset per block of code so yes, {_playersJoined} will be zero on load, but only for that section of code. Also, the request is that they want it to be so that at least 10 players are online before a key all type command is run. Your code doesn't account for if a player leaves.
 
oh ok ill try something else

Code:
on load:
    set {playersOnline} to 0

on join:
    add 1 to {playersOnline}
    checkPlayers()

on quit:
    substract 1 from {playersOnline}
    
    
function checkPlayers():
    if {playersOnline} is 10:
        execute console command "/keyall small"

do you think something like this would work?
 
oh ok ill try something else

Code:
on load:
    set {playersOnline} to 0

on join:
    add 1 to {playersOnline}
    checkPlayers()

on quit:
    substract 1 from {playersOnline}
   
   
function checkPlayers():
    if {playersOnline} is 10:
        execute console command "/keyall small"

do you think something like this would work?
Yep, that would work. Just replace subtract with remove. However; this would be a note to whoever wants to use this for their server; you'd want to make sure that you have a way to reset/modify the code for the function to CheckPlayers. This is because of the possibility of their being 9 players on and another player just leaving and rejoining a ton which would cause /keyall small to be executed many times. You can fix this with either a cooldown or a way to reset the variable after the console command is run.
 
  • Like
Reactions: lwgy