Discord Thread Chat Ping Message

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

This thread came from the skUnity Discord. You can't reply to it here but if you join the skUnity Discord, you'll be able to post a reply there. The thread link is part of the thread's message.
Status
Not open for further replies.

skUnity Discord

Site Manager
Aug 5, 2023
12,755
1
0
The skUnity Discord
discord.gg
I have a custom staff chat Skript that I have made, but I want to make sure that if a staff member types in there, the person does not receive a notification saying their name was mentioned.

Chat Ping Skript
code_language.skript:
on chat:
    if {staffchat::toggle::%player's uuid%} or (metadata tag "vanished" of player) is true:
        stop
    else:
        loop all players:
            if message contains "%loop-player%":
                replace all "%loop-player%" with "&b&l@%loop-player%&r" in message
                play sound "block.note_block.pling" with volume 1 for loop-player

**Staff Chat Command Skript**
command /staffchat [<text>]:
    aliases: /sc, /schat, /mc, /modchat, /adminchat, /ch, /st, /ac
    permission: sc.use
    permission message: {@no_perm}
    trigger:
        if arg-1 is not set:
            send "&7Please input a message to send to other staff!"
        if arg-1 is set:
            loop all players:
                if loop-player has permission "sc.use":
                    send "&8[&aStaffChat&8] &6%player%: &b%arg-1%" to loop-player

Anyone familiar with this kind of thing at all? I'm still very new with Skript and I am looking for support on this.

Posted by: james.kevin from the skUnity Discord. View the thread on skUnity Discord here
 
Currently, when anyone does /st (staffchat), that is the case, however when they are in /sctoggle

code_language.skript:
command /sctoggle:
    aliases: sttoggle, mctoggle, actoggle
    permission: sc.toggle
    permission message: {@no_perm}
    trigger:
        if {staffchat::toggle::%player's uuid%} is not set:
            set {staffchat::toggle::%player's uuid%} to false
        if {staffchat::toggle::%player's uuid%} is false:
            set {staffchat::toggle::%player's uuid%} to true
            send "&aStaff Chat is now Enabled!"
            stop trigger
        else if {staffchat::toggle::%player's uuid%} is true:
            set {staffchat::toggle::%player's uuid%} to false
            send "&aStaff Chat is now Disabled."

It still processes the mention, which is not what I am wanting
Nevermind, I think I've got it figured out for now.
---

I've got above working, however I am now trying to add another thing and I am not familiar with other plugin integration into Skript
I am wanting it so if said in chat the full username or the EssentialsX's nickname for that player is said, it notifies them

        loop all players:
            if message contains "%loop-player%" or loop-player's "%essentials nickname%":
                replace all "%loop-player%" with "&b@%loop-player%&r" in message
                play sound "block.note_block.pling" with volume 1 for loop-player
                set {ping_cooldown::%player's uuid%} to now

This is what I have at the moment, and that's obviously not working, and I am not too familiar with plugin integration as mentioned.

Posted by: james.kevin from the skUnity Discord.
 
I want to say nickname of player is a thing, but I'm not sure. I know you can get player's prefix and player's suffix however. to get everything else, you may need to use PlaceholderAPI and the skript-placeholders Skript addon (or use skript-reflect if you have some Java knowledge)

Posted by: tobyminceraft from the skUnity Discord.
 
I tried something along the lines of:

code_language.skript:
        loop all players:
            if message contains "%loop-player%" or loop-player's displayname:
                replace all "%loop-player%" with "&b@%loop-player%&r" in message
                play sound "block.note_block.pling" with volume 1 for loop-player
                set {ping_cooldown::%player's uuid%} to now
but it still did not process

Posted by: james.kevin from the skUnity Discord.
 
code_language.skript:
    if {staffchat::toggle::%player's uuid%} or (metadata tag "vanished" of player) is true:
        stop
    else:
Btw just

{staffchat::toggle::%player's uuid%} or (metadata tag "vanished" of player) is false
#code
this is a flat condition, when it fails it acts as a stop

Posted by: _grifin_ from the skUnity Discord.
 
code_language.skript:
on chat:
    if {staffchat::toggle::%player's uuid%} or {staffchat::message} or (metadata tag "vanished" of player) is false:
        if {ping_cooldown::%player's uuid%} is not set:
            set {ping_cooldown::%player's uuid%} to 30 seconds ago
            loop all players:
                if message contains "%loop-player%" or uncolored loop-player's displayname:
                    replace all "%loop-player%" with "&b@%loop-player%&r" in message
                    replace all uncolored loop-player's displayname with "&b@%loop-player%&r" in message
                    play sound "block.note_block.pling" with volume 1 for loop-player
                    set {ping_cooldown::%player's uuid%} to now
        if time since {ping_cooldown::%player's uuid%} >= 30 seconds:
            loop all players:
                if message contains "%loop-player%" or uncolored loop-player's displayname:
                    replace all "%loop-player%" with "&b@%loop-player%&r" in message
                    replace all uncolored loop-player's displayname with "&b@%loop-player%&r" in message
                    play sound "block.note_block.pling" with volume 1 for loop-player
                    set {ping_cooldown::%player's uuid%} to now
        else:
            loop all players:
                if message contains "%loop-player%":
                    replace all "%loop-player%" with "&b%loop-player%&r" in message
                    send "&aYou can only ping users every 30 seconds!"

This is now what I have (Thanks to you and grifin), however, it still does not display. The prefix for nicknames under EssentialsX is ~, so I don't know if I need to type ~nicknamehere or just nicknamehere for it to work, but neither seemed to work.
Still trying off and on with this, but cannot seem to get far. Anyone have any ideas?

Posted by: james.kevin from the skUnity Discord.
 
Status
Not open for further replies.