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.

How do I add arguments to a list?

Discussion in 'Skript' started by akatas, Feb 16, 2021.

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

    akatas New Member

    Joined:
    Feb 16, 2021
    Messages:
    7
    Likes Received:
    0
    So I’m trying to make a friends list on my server (adding, removing, opening friend list, all that stuff), and I’m pretty sure I might be doing something wrong. I also want to figure out how to make each person have their own friends list. I’m just learning skript, so I’m going to make plenty of mistakes, and other random stuff.


    Here is an example code for adding a friend:

    Code (Text):
    1. command /friend [add] <player>:
    2.  
    3.   if arg-1 is online   // <— this might not be real code idk:
    4.     send “%player% has sent a friend request!” to arg-1
    5.     send “You sent a friend request to %arg-1%!” to player
    6.   else:
    7.     send “%arg-1% is not online right now” to player

    Here is some code for accepting the friend request:

    Code (Text):
    1. command /friend [accept] <player>:
    2.   if arg-1 is online:
    3.     if {%player%friendslist::*} does not contain arg-1:
    4.       send “%player% has accepted your request!% to arg-1
    5.       send “You are now friends with %arg-1%”
    6.       add arg-1 to {%player%friendslist::*}
    7.       add player to {%arg-1%friendlist::*}   // I really don’t know what I’m doing
    8.     else:
    9.       send “%arg-1% is already your friend!”
    10.   else:
    11.     send “%arg-1% is not online right now”
    But I’m wondering if you can add arguments to a list, and remove that specific argument. So if someone could help, that would be greatly appreciated! Thanks
     
  2. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    You have to put "trigger" when you go to create a command.

    Code (Skript):
    1.  
    2. command /friend [<string>] [<offline player>]:
    3.     trigger:
    4.         #...
    5.  
    --- Double Post Merged, Feb 23, 2021, Original Post Date: Feb 23, 2021 ---
    Also, you have a bit of unnecessary code. Could reduce it to like this:

    Code (Skript):
    1. command /friend [<string>] [<offline player>]:
    2.     trigger:
    3.         arg 1 is "add":
    4.             #Code
    5.         arg 1 is "accept":
    6.             #Code
     
    • Like Like x 2
  3. akatas

    akatas New Member

    Joined:
    Feb 16, 2021
    Messages:
    7
    Likes Received:
    0
    I knew there was a way to check when arg-1 is a specific value! Do you need to use “trigger:”? also, my main problem is Can you add an argument value to a list? thanks!
     
  4. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    A list? Do you mean to a variable like this?
    Code (Skript):
    1. command /friend [<string>] [<offline player>]:
    2.    trigger:
    3.        arg 1 is "add":
    4.            arg 2 is set:
    5.                add arg 2 to {friends::list::%player%::*}
    6.        arg 1 is "list":
    7.            send "&8                   "
    8.            loop {friends::list::%player%::*}
    9.            
    10.                send "%loop-value%"
    11.            send "&8                   "
    --- Double Post Merged, Feb 24, 2021, Original Post Date: Feb 23, 2021 ---
    Edit: i add a " to send loop-value message.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...