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

need help with chat skript

Discussion in 'Skript' started by ComPieter, Aug 14, 2019 at 9:02 PM.

  1. ComPieter

    ComPieter Member

    Joined:
    Wednesday
    Messages:
    8
    Likes Received:
    0
    dont know why this isn't working cause i am bad at skript :/ i want to be able to ignore an player in /msg and in chat at the same time and also have an player list of ignored players

    i use this for an anarchy server where players need to be able to mute other players
     

    Attached Files:

    • chat.sk
      File size:
      2.1 KB
      Views:
      6
    #1 ComPieter, Aug 14, 2019 at 9:02 PM
    Last edited: Aug 14, 2019 at 9:30 PM
  2. malia

    malia Well-Known Member

    Joined:
    Jul 24, 2019
    Messages:
    189
    Likes Received:
    17
    Mostly pseudo code, but should work. Fix the errors if any.

    Code (Skript):
    1. options:
    2.     ERROR_MESSAGE = &c[ M.A.L.I.A ] - An error occurred while trying to execute the command.
    3.  
    4. on load:
    5.     if file "plugins/Malia/chat/config.yml" doesn't exist:
    6.         create file "plugins/Malia/chat/config.yml"
    7.  
    8. on join:
    9.     if file "plugins/Malia/chat/players/%player's uuid%.yml" doesn't exist:
    10.         create file "plugins/Malia/chat/players/%player's uuid%.yml"
    11.  
    12. command /uuid [<offline player>]:
    13.     trigger:
    14.         if arg-1 is not set:
    15.             send "%{@ERROR_MESSAGE}% &7&o(Usage: /uuid <player>)" to player
    16.             stop
    17.         send "&a%arg-1%'s UUID: &7%arg-1's uuid%"
    18.  
    19. command /ignore [<offline player>]:
    20.     trigger:
    21.         if arg-1 is not set:
    22.             send "%{@ERROR_MESSAGE}% &7&o(Usage: /ignore <player>)" to player
    23.             stop
    24.         add "%arg-1's uuid%" to {LIST::IGNORED::%player%::*}
    25.         set yml value "%arg-1's uuid%" in "plugins/Malia/chat/players/%player's uuid%.yml" to true
    26.  
    27. on chat:
    28.     loop all players:
    29.         loop {LIST::IGNORED::%loop-player%::*}:
    30.             if {LIST::IGNORED::%loop-player%::*} contains %loop-index's uuid%:
    31.                 cancel event
    32.  
    TODO: Load ignored people from the file

    Edit:
    On your code, you're missing intendation, anyways isn't this line the issue?
    Code (Skript):
    1. if {ignore::%loop-player's uuid%::*} is player:
    Try with "is sender"
     
    • Like Like x 1
  3. ComPieter

    ComPieter Member

    Joined:
    Wednesday
    Messages:
    8
    Likes Received:
    0
    thanks but still have an isseu with /msg


    if arg-1 is set:
    if {ignore::%uuid of player%::*} is sender:
    stop
    else:
    if arg-2 is set:
    set {message.%player%} to arg 1
    set {message.%arg 1%} to player
    send "&bFrom: &a%player%&r &7> &6%arg 2%" to arg 1
    send "&bTo: &a%arg 1%&r &7> &6%arg 2%" to player
    --- Double Post Merged, Aug 15, 2019 at 12:47 AM, Original Post Date: Aug 15, 2019 at 12:20 AM ---
    this doesn't work of course:


    if arg-1 is set:
    loop recipients:
    if {ignore::%loop-player's uuid%::*} is sender:
    remove loop-player from recipients
    --- Double Post Merged, Aug 15, 2019 at 12:59 AM ---

    i tried it but got many errors probbaly need an addod but dont know what for addon


    [23:58:18 ERROR]: [Skript] 'ERROR_MESSAGE = &c[ M.A.L.I.A ] - An error occurred while trying to execute the command.' is not an entry (like 'name : value') (chat2.sk, line 2: ERROR_MESSAGE = &c[ M.A.L.I.A ] - An error occurred while trying to execute the command.')
    [23:58:18 ERROR]: [Skript] can't understand this condition: 'file "plugins/Malia/chat/config.yml" doesn't exist' (chat2.sk, line 5: if file "plugins/Malia/chat/config.yml" doesn't exist:')
    [23:58:18 ERROR]: [Skript] can't understand this condition: 'file "plugins/Malia/chat/players/%player's uuid%.yml" doesn't exist' (chat2.sk, line 9: if file "plugins/Malia/chat/players/%player's uuid%.yml" doesn't exist:')
    [23:58:18 ERROR]: [Skript] undefined option {@ERROR_MESSAGE} (chat2.sk, line 15: send "%{@ERROR_MESSAGE}% &7&o(Usage: /uuid <player>)" to player')
    [23:58:18 ERROR]: [Skript] undefined option {@ERROR_MESSAGE} (chat2.sk, line 22: send "%{@ERROR_MESSAGE}% &7&o(Usage: /ignore <player>)" to player')
    [23:58:18 WARN]: [Skript] the UUID of the 1st argument is already a text, so you should not put it in one (e.g. the UUID of the 1st argument instead of "%the UUID of the 1st argument%") (chat2.sk, line 24: add "%arg-1's uuid%" to {LIST::IGNORED::%player%::*}')
    [23:58:18 ERROR]: [Skript] Can't understand this condition/effect: set yml value "%arg-1's uuid%" in "plugins/Malia/chat/players/%player's uuid%.yml" to true (chat2.sk, line 25: set yml value "%arg-1's uuid%" in "plugins/Malia/chat/players/%player's uuid%.yml" to true')
    [23:58:18 ERROR]: [Skript] can't understand this condition: '{LIST::IGNORED::%loop-player%::*} contains %loop-index's uuid%' (chat2.sk, line 30: if {LIST::IGNORED::%loop-player%::*} contains %loop-index's uuid%:')
     

    Attached Files:

    • chat.sk
      File size:
      2.1 KB
      Views:
      1
  4. malia

    malia Well-Known Member

    Joined:
    Jul 24, 2019
    Messages:
    189
    Likes Received:
    17
    Code (Text):
    1. loop {ignore::%loop-player's uuid%::*}:
    2.     # do your thing
    I'm not sure but I believe you have to loop that, anyways that was pseudo code fix the errors. Addons are easy to find
     
    • Like Like x 1
  5. ComPieter

    ComPieter Member

    Joined:
    Wednesday
    Messages:
    8
    Likes Received:
    0
    thank you but i am trying for a while now and it just won't work i am losing it i fixed most of the problems in your skript but it's again the loop that doesn't work

    Update/Edit: it works now and i have merged for the most part your skript with mine and made some adjustments
    also the yaml value works now but i need an ways to read it its probbaly this i guess

    if yaml value of "%arg-1's uuid%" of file "plugins/solito/chat/players/%player's uuid%.yml" is true:
    # do the rest i guess but correct me if i am wrong
     

    Attached Files:

    • chat.sk
      File size:
      3.2 KB
      Views:
      0
    #5 ComPieter, Aug 16, 2019 at 1:53 PM
    Last edited: Aug 16, 2019 at 5:27 PM
  6. malia

    malia Well-Known Member

    Joined:
    Jul 24, 2019
    Messages:
    189
    Likes Received:
    17
    Yeah that should do the trick :emoji_slight_smile:
     
    • Like Like x 1
  7. ComPieter

    ComPieter Member

    Joined:
    Wednesday
    Messages:
    8
    Likes Received:
    0
    yeah i does but i have an problem skUtilities has also the same yaml (almost) and that conflicts with skript yaml
    also i need to find an way to hide chat completely with /chattoggle
     

    Attached Files:

    • chat.sk
      File size:
      4.4 KB
      Views:
      0
  8. malia

    malia Well-Known Member

    Joined:
    Jul 24, 2019
    Messages:
    189
    Likes Received:
    17
    Delete skript yaml if you use skUtilities

    Pseudo code:
    Code (Skript):
    1. on join:
    2.     if file "plugins/Malia/players/%player's uuid%.yml" doesn't exist:
    3.         create file "plugins/Malia/players/%player's uuid%.yml"
    4.         set yml value "chat-mute" of file "plugins/Malia/players/%player's uuid%.yml" to true
    5.         set {CHAT::MUTED::%player%} to false
    6.     else:
    7.         set {CHAT::MUTED::%player%} to yml value "chat-mute" of file "plugins/Malia/players/%player's uuid%.yml"
    8.  
    9. command /chattoggle:
    10.     aliases: /ct
    11.     trigger:
    12. # !have no idea how it works on skript, but in real languages it would be simplified with VAR = !VAR #
    13.         if {CHAT::MUTED::%player%} is false:
    14.             set {CHAT::MUTED::%player%} to true
    15.         else:
    16.             set {CHAT::MUTED::%player%} to false
    17.  
    18. on chat:
    19.     if {CHAT::MUTED::%recipient%} is true:
    20.         cancel event
    21.     if {CHAT::MUTED::%player%} is true:
    22.         cancel event
    23.         send "&c[ M.A.L.I.A ] -> You have muted the chat! Therefore you cannot see messages."
     
    • Like Like x 1
  9. ComPieter

    ComPieter Member

    Joined:
    Wednesday
    Messages:
    8
    Likes Received:
    0
    thanks part of it work tho
    this part doesn't also i get an error when using yaml for my telltogle why idk

    if {CHAT::MUTED::%recipients%} is true:
    cancel event
     

    Attached Files:

  10. malia

    malia Well-Known Member

    Joined:
    Jul 24, 2019
    Messages:
    189
    Likes Received:
    17
    Show me the line of code to yaml, I have no other idea on how to cancel event to recipients... Sorry
     
  11. ComPieter

    ComPieter Member

    Joined:
    Wednesday
    Messages:
    8
    Likes Received:
    0
    i think it's this one but i am not sure
    set yml value "chat-mute" of file "plugins/solito/chat/players/%player's uuid%.yml" to true

    or it's this one if yaml value "tell-mute" of file "plugins/solito/chat/players/%player's uuid%.yml" is true
     
  12. malia

    malia Well-Known Member

    Joined:
    Jul 24, 2019
    Messages:
    189
    Likes Received:
    17
    Code (Skript):
    1. if yaml value "tell-mute" of file "plugins/solito/chat/players/%player's uuid%.yml" is true  # -> NO
    2.  
    3. set {VAR} to yml value "tell-mute" of file "plugins/solito/chat/players/%player's uuid%.yml" is true
    4.  
    5. # try this, i believe you cannot check it directly i'm not sure
     
Loading...