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.

make it so a command checks everyone

Discussion in 'Skript' started by Pup_lboo, Mar 29, 2022.

Tags:
Thread Status:
Not open for further replies.
  1. Pup_lboo

    Pup_lboo Member

    Joined:
    Mar 15, 2022
    Messages:
    13
    Likes Received:
    0
    when i use this code it gives the right gun to the player who did /start but everyone else gets a pistol only
    Code (Text):
    1. command /start:
    2.     cooldown : 1 minute
    3.     cooldown message: "please wait to start"
    4.     trigger:
    5.         kill all arrows
    6.         remove all arrow from player
    7.         remove all diamond horse armor from players
    8.         remove all golden horse armor from players
    9.         remove all iron horse armor from players
    10.         teleport all players to location (-16.7, 59, 5.3)
    11.         wait 200 ticks
    12.         give all players iron horse armor named "&7Pistol"
    13.         player has permission "{ak}":
    14.             wait 3 ticks
    15.             give player golden horse armor named "&6Ak-47"
    16.         player has permission "{op}":
    17.             wait 3 ticks
    18.             give player diamond horse armor named "&bShotGun"
    19.         player has permission "{SR}":
    20.             wait 3 ticks
    21.             give player diamond horse armor named "&2Sniper Rifle"
     
  2. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    I have seen people trying something like this. I am not good at loops I am trying to give you ideas. try looking for old loop players inside a variable to see if you find something for you.
    Code (Text):
    1. command /join:
    2.     trigger:
    3.         add player to {game_guns::*}
    4.         #to remove try remove player from {game_guns::*}
    5. command /start:
    6.     trigger:
    7.         give a diamond sword to the player #This will give the item for the one who execute /start
    8.         loop {game_guns::*}:  
    9.             give loop-player a iron sword # This will give the sword to everyone inside {game::guns}
    10.             #if the one who execute the command is inside remove the pistol from him if you want to
     
  3. Pup_lboo

    Pup_lboo Member

    Joined:
    Mar 15, 2022
    Messages:
    13
    Likes Received:
    0
    says theres no loop that matches loop-player
    i dont know hot to use loops so idk what how to fix
     
  4. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    try this instead
    Code (Text):
    1. command /join:
    2.     trigger:
    3.         add player to {game_guns::*}
    4.         #to remove try remove player from {game_guns::*}
    5. command /start:
    6.     trigger:
    7.         give a diamond sword to the player #This will give the item for the one who execute /start
    8.         loop {game_guns::*}:
    9.             give {game_guns::*} a iron sword # This will give the sword to everyone inside {game::guns}
    10.             #if the one who execute the command is inside remove the pistol from him if you want to
    or this
    Code (Text):
    1. command /join:
    2.     trigger:
    3.         add player to {game_guns::*}
    4.         #to remove try remove player from {game_guns::*}
    5. command /start:
    6.     trigger:
    7.         give a diamond sword to the player #This will give the item for the one who execute /start
    8.         loop {game_guns::*}:
    9.             give loop-value a iron sword # This will give the sword to everyone inside {game::guns}
    10.             #if the one who execute the command is inside remove the pistol from him if you want to
     
  5. Pup_lboo

    Pup_lboo Member

    Joined:
    Mar 15, 2022
    Messages:
    13
    Likes Received:
    0
    gives me a diamond sword but no one gets a iron sword
     
  6. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    Also you can try this.
    Code (Text):
    1. command /join:
    2.     trigger:
    3.         add player to {game_guns::*}
    4.         #to remove try remove player from {game_guns::*}
    5. command /start:
    6.     trigger:
    7.         give a diamond sword to the player #This will give the item for the one who execute /start
    8.         loop all players in {game_guns::*}:
    9.             give loop-player a iron sword # This will give the sword to everyone inside {game::guns}
    10.             #if the one who execute the command is inside remove the pistol from him if you want to
     
  7. Pup_lboo

    Pup_lboo Member

    Joined:
    Mar 15, 2022
    Messages:
    13
    Likes Received:
    0
    still only gives me a sword
     
  8. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    Check if the list contains players
    Code (Text):
    1. Command /test:
    2.     Trigger:
    3.         Add player to {game_guns::*}
    4.         Message "%{game_guns::*}%"
    5. #if not try
    6. Command /test:
    7.     Trigger:
    8.         Add "%player%" to {game_guns::*}
    9.         Message "%{game_guns::*}%"
     
  9. Pup_lboo

    Pup_lboo Member

    Joined:
    Mar 15, 2022
    Messages:
    13
    Likes Received:
    0
    sends my name 4 times sends my friends name 1 time and send iron sword like 20 times
     
  10. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    To clear the variable do delete {game_guns::*}
    Let me see if I find how to give items to payers inside a list
     
  11. Pup_lboo

    Pup_lboo Member

    Joined:
    Mar 15, 2022
    Messages:
    13
    Likes Received:
    0
  12. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    Try this make sure to add players to {game_guns::*}
    Code (Text):
    1. command /join:
    2.     trigger:
    3.         add player to {game_guns::*}
    4.         #to remove try remove player from {game_guns::*}
    5. command /start:
    6.     trigger:
    7.         give a diamond sword to the player #This will give the item for the one who execute /start
    8.         loop {game_guns::*}:
    9.             give loop-index a iron sword # This will give the sword to everyone inside {game::guns}
    10.             #if the one who execute the command is inside remove the pistol from him if you want to
     
  13. Pup_lboo

    Pup_lboo Member

    Joined:
    Mar 15, 2022
    Messages:
    13
    Likes Received:
    0
    says loop-index cant have anything added to it
     
  14. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
    Try this
    Code (Text):
    1. command /join:
    2.     trigger:
    3.         add player to {game_guns::*}
    4.         #to remove try remove player from {game_guns::*}
    5. command /start:
    6.     trigger:
    7.         give a diamond sword to the player #This will give the item for the one who execute /start
    8.         loop {game_guns::*}:
    9.             give {game_guns::%loop-index%} a iron sword # This will give the sword to everyone inside {game::guns}
    10.             #if the one who execute the command is inside remove the pistol from him if you want to
     
  15. Pup_lboo

    Pup_lboo Member

    Joined:
    Mar 15, 2022
    Messages:
    13
    Likes Received:
    0
    it worked! thanks
     
  16. Mich

    Mich Active Member

    Joined:
    Jul 15, 2020
    Messages:
    148
    Likes Received:
    5
Thread Status:
Not open for further replies.

Share This Page

Loading...