Solved Team spawn

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

Ariuw

Member
Sep 6, 2017
42
1
8
30
Hello again.

Since last night I've been working on a 'simple' skript that Teleports a complete team to a spawn base. this is my code:

Code:
command /spawnset [<text>]:
    trigger:
        if arg-1 is "Blue":
            set {blue.location} to location of player
            message "&1Blue &fspawn has been setted"
        if arg-1 is "red":
            set {red.location} to location of player
            message "&cRed &fspawn has been setted"
        if arg-1 is "none":
            set {none.location} to location of player
            message "&bNone &fspawn has been setted"

so when I use it tps them to their team spawn

Code:
command /begin:
    trigger:
        loop all players:
            if {ir::red::%player%} is set:
                teleport player to {red.location}
        loop all players:
            if {ir::blue::%player%} is set:
                teleport player to {orange.location}
        loop all players:   
            if {ir::none::%player%} is set:
                teleport player to {none.location}  
                clear player's inventory
                set gamemode of player to Creative

Let me know if you guys want me to paste the join skript
 
In the second code, you're using player instead of loop-player
 
like this

code_language.skript:
command /begin:
    trigger:
        loop all players:
            if {ir::red::%loop-player%} is set:
                teleport loop-player to {red.location}
            if {ir::blue::%loop-player%} is set:
                teleport loop-player to {orange.location}
            if {ir::none::%loop-player%} is set:
                teleport loop-player to {none.location}
                clear loop-player's inventory
                set gamemode of loop-player to Creative
 
like this

code_language.skript:
command /begin:
    trigger:
        loop all players:
            if {ir::red::%loop-player%} is set:
                teleport loop-player to {red.location}
            if {ir::blue::%loop-player%} is set:
                teleport loop-player to {orange.location}
            if {ir::none::%loop-player%} is set:
                teleport loop-player to {none.location}
                clear loop-player's inventory
                set gamemode of loop-player to Creative

It doesn't not tp the player in both red or blue to their team spawn
 
this means you not set the variables
[doublepost=1534631251,1534631042][/doublepost]
code_language.skript:
command join-RED:
    trigger:
        set {TEAM-%player%} to "RED"
       
command join-BLUE:
    trigger:
        set {TEAM-%player%} to "BLUE"  


command BEGIN:
    trigger:
        loop all players:
            teleport loop-player to {spawn.%{TEAM-%player%}%}
           
command setspawn-BLUE:
    trigger:
        set {spawn.BLUE} to player's location
       
command setspawn-RED:
    trigger:
        set {spawn.RED} to player's location
 
This is my actual code:

Code:
command /spawnset [<text>]:
    trigger:
        if arg-1 is "Blue":
            set {blue.location} to location of player
            message "&1Blue &fspawn has been setted"
        if arg-1 is "red":
            set {red.location} to location of player
            message "&cRed &fspawn has been setted"
        if arg-1 is "none":
            set {none.location} to location of player
            message "&bNone &fspawn has been setted"

Code:
command /begin:
    trigger:
        loop all players:
            if {ir::red::%player%} is set:
                teleport player to {red.location}
        loop all players:
            if {ir::blue::%player%} is set:
                teleport player to {blue.location}
        loop all players:
            if {ir::none::%player%} is set:
                teleport player to {none.location}
                clear player's inventory
                set gamemode of player to Creative

Code:
command /red:
    trigger:
        if {ir::red::%player%} is false:
            if {ir::red} < 8:
                if {ir::red::%player%}:
                    add -1 to {ir::bluee}
                    add -1 to {ir::obs}
                    add 1 to {ir::red}
                set {ir::red::%player%} to true
                set {ir::blue::%player%} to false
                set {ir::none::%player%} to false
                message "&7You have joined the &cRed &7team"
                set player's tab list name to "&c%player%"
            else:
                message "&7Team full!"
        else:
            message "&7You are already in the &cRed &7team."

Code:
command /blue:
    trigger:
        if {ir::blue::%player%} is false:
            if {ir::blue} < 8:
                if {ir::blue::%player%}:
                    add -1 to {ir::red}
                    add -1 to {ir::none}
                    add 1 to {ir::blue}
                set {ir::blue::%player%} to true
                set {ir::red::%player%} to false
                set {ir::none::%player%} to false
                message "&7You have joined the &1Blue &7team"
                set player's tab list name to "&1%player%"
            else:
                message "&7Team full!"
        else:
            message "&7You are already in the &1Blue &7team."

Can you help me doing this on the skript? as I alway say. It's okay if you don't want to wast your time on me :emoji_stuck_out_tongue:
In the /red and /blue commands, the first line is
code_language.skript:
if {ir::blue/red::%player%} is false:
but in the teleportation code you're using if {ir::blue/red::%loop-player%} is set. So when a player chooses ANY team, the variable for all 3 teams will be set (but only 1 to true, the other 2 to false), so the condition if {ir::blue/red::%loop-player%} is set, will always result in true when a player has chosen any team.
 
Status
Not open for further replies.