An extremely confusing script that i need help with

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

acai

Active Member
Oct 23, 2020
89
1
8
Code:
command /friends [<text>] [<player>]:
  permission: acai.friendscmd
  trigger:
    if arg-1 is "add":
      if arg-2 is set:
        add arg-2 to {friendslist::%player%}
    else:
      if arg-1 is "remove":
        if arg-2 is set:
          remove arg-2 from {friendslist::%player%}
      else:
        if arg-1 is "chat":
          if {fchat.%player%} is 0:
            set {fchat.%player%} to 1
          else:
            if {fchat.%player%} is 1:
              set {fchat.%player%} to 0

on chat:
  if {fchat.%player%} is 1:
    cancel event
    loop all players:
      if {friendslist::%loop-player%} contains %player%:
        if {fchat.%loop-player%} is 1:
          send "&1&lFRIEND-CHAT &f&l> &r%player% - %message%" to loop-player

Hello, I am currently making a chat system, where it will send a player's chat message to their friends if they have {fchat.%player%} enabled, and their friends have it on too. The only resource I could find for this was over a year old, and it was a spigot thread.
Any help on redirecting a player's message to their friends contained on their friends list? Thank you!

Would there be a way
[doublepost=1607104102,1607093437][/doublepost]Never mind, have fixed with this code:
Code:
command /friends [<text>] [<player>]:
  permission: acai.friendscmd
  trigger:
    if arg-1 is "add":
      if arg-2 is set:
        add arg-2 to {friendslist::%player%}
    else:
      if arg-1 is "remove":
        if arg-2 is set:
          remove arg-2 from {friendslist::%player%}
      else:
        if arg-1 is "chat":
          if {fchat.%player%} is 0:
            set {fchat.%player%} to 1
          else:
            if {fchat.%player%} is 1:
              set {fchat.%player%} to 0
 
on chat:
  if {fchat.%player%} is 1:
    cancel event
    loop all players:
      if {friendslist::%loop-player%} contains player:
        if {fchat.%loop-player%} is 1:
          send "&1&lFRIEND-CHAT &f&l> &r%player% - %message%" to loop-player
 
Status
Not open for further replies.