Selecting 1 player in a certain world that aren't already associated with a certain variable!

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

Status
Not open for further replies.
I

iNuclearTNT

Let me explain what the title means. The problem I'm having is that I'm trying to put players into "teams" with skript, don't worry how I'll actually put them into teams, I'm just scratching my head about the skript-code part.

Trying to put ppl into teams without putting them into another team by accident. I cannot select a player(s) that already have a team, below is the code I imagine myself using to make life easy.

Selecting multiple players that aren't associated with the variable: {team.blue}

set {team.green} to random element out of all players that aren't {team.blue} in world "GameWorld"


Maybe I'm doing this all wrong, how would you approach making a simple 2 teams work?
 
A vanilla Skript solution would be:
code_language.skript:
loop players in world "GameWorld":
    {team.blue} isn't loop-player
    add loop-player to {_potentials::*}
set {team.green} to random element out of {_potentials::*}
Like Pika said, a where filter from SkQuery would let you shorten it to one line. You can find it on the docs (expressions page).
 
Status
Not open for further replies.