Solved Problems cheking if a player is muted

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

krainser

Member
Jan 27, 2017
60
3
3
35
Argentina
Hi!
I have some issues checking if a player is muted, i looked for some addon could help me but i didn't found one, there is anyway to check it? thanks!
 
No I think there isn't such function. But you can script the mute-system yourself. Here is an examle you could use:

code_language.skript:
on join:
    set {%player%.mute} to false
    stop

on quit:
    clear {%player%.mute}
    stop
  
on chat:
    if {%player%.mute} is true:
        message "&cYou are muted!"
        cancel event
    stop

command /mute <text="">:
    trigger:
        if player has permission "chat.mute":
            loop all players:
                if "%arg 1%" is "%loop-player%":
                    if {%loop-player%.mute} is true:
                        message "&cPlayer is alredy muted!"
                    else:
                        set {%loop-player%.mute} to true
                        message "&aYou have muted &6%name of loop-player%!"
                        message "&cYou were muted from &6%name of player%!" to loop-player
                    stop trigger
            message "&cPlayer not found!"
        else:
            message "&cNo Permission!"
        stop trigger

command /unmute <text="">:
    trigger:
        if player has permission "chat.unmute":
            loop all players:
                if "%arg 1%" is "%loop-player%":
                    if {%loop-player%.mute} is false:
                        message "&cPlayer isn't muted!"
                    else:
                        set {%loop-player%.mute} to false
                        message "&aYou have unmuted &6%name of loop-player%!"
                        message "&aYou were unmuted from &6%name of player%" to loop-player
                    stop trigger
            message "&cPlayer not found!"
        else:
            message "&cNo Permission!"
        stop trigger

So you only have to set the permissions:

chat.mute - /mute <player>
chat.unmute - /unmute <player>

So I hope this helps. i haven't testet it ye but it should work.
 
Last edited by a moderator:
No I think there isn't such function. But you can script the mute-system yourself. Here is an examle you could use:

code_language.skript:
on join:
    set {%player%.mute} to false
    stop

on quit:
    clear {%player%.mute}
    stop
  
on chat:
    if {%player%.mute} is true:
        message "&cYou are muted!"
        cancel event
    stop

command /mute <text="">:
    trigger:
        if player has permission "chat.mute":
            loop all players:
                if "%arg 1%" is "%loop-player%":
                    if {%loop-player%.mute} is true:
                        message "&cPlayer is alredy muted!"
                    else:
                        set {%loop-player%.mute} to true
                        message "&aYou have muted &6%name of loop-player%!"
                        message "&cYou where muted from &6%name of player%!" to loop-player
                    stop trigger
            message "&cPlayer not found!"
        else:
            message "&cNo Permission!"
        stop trigger

command /unmute <text="">:
    trigger:
        if player has permission "chat.unmute":
            loop all players:
                if "%arg 1%" is "%loop-player%":
                    if {%loop-player%.mute} is false:
                        message "&cPlayer isn't muted!"
                    else:
                        set {%loop-player%.mute} to false
                        message "&aYou have unmuted &6%name of loop-player%!"
                        message "&aYou where unmuted from &6%name of player%" to loop-player
                    stop trigger
            message "&cPlayer not found!"
        else:
            message "&cNo Permission!"
        stop trigger

So you only have to set the permissions:

chat.mute - /mute <player>
chat.unmute - /unmute <player>

So I hope this helps. i haven't testet it ye but it should work.

Thanks! but i trust more in the essentials mute system, i have more safety and control (like time and more)
 
Thanks! but i trust more in the essentials mute system, i have more safety and control (like time and more)

So, it is also possible to implement timed mute... So are there other features that you would like to have in an mute system? And as long as the script is running it cannot be unsafer as essentials :emoji_slight_smile:
 
So, it is also possible to implement timed mute... So are there other features that you would like to have in an mute system? And as long as the script is running it cannot be unsafer as essentials :emoji_slight_smile:
Im pretty newbie in skript, and all the info is in English, so its difficult to me understand some things.
By the way, I "solve" this with an -on chat- event, if you are able to chat means that you are not muted. So i made a variable that sets muted to true, ans if you talks its sets to false
 
@Spirit1998HD

Nice code. but can you maybe try to remove the useless Variables? D: xD

example. You don't need "on join" events and "on quit" just do this simple. and smaller. and effiferzen

code_language.skript:
command /mute [<player>]:
    trigger:
        if arg-1 is not set:
            send "&cWho do you wan't mute?"
        else:
            if {Mute::%arg-1%} is set:
                send "&cHe is already muted?"
            else:
                set {Mute::%arg-1%} to true
                send "&cHe is now muted by you"
                send "&7You has been muted by %player%" to arg-1

command /unmute [<player>]:
    trigger:
        if arg-1 is not set:
            send "&cWho do you wan't mute?"
        else:
            if {Mute::%arg-1%} is not set:
                send "&cHe is not muted?"
            else:
                delete {Mute::%arg-1%}
                send "&cHe is now unbemuted"
                send "&7You has been &cUN&7muted by %player%" to arg-1
      
on chat:
    if {Mute::%player%} is set:
        cancel event
         send "You can't chat somethings. you been muted!"
 
Im pretty newbie in skript, and all the info is in English, so its difficult to me understand some things.
By the way, I "solve" this with an -on chat- event, if you are able to chat means that you are not muted. So i made a variable that sets muted to true, ans if you talks its sets to false

Yeah, thats the right way and this what @ChisleLP posted is a compact version of mine :emoji_slight_smile:.

@Spirit1998HD

Nice code. but can you maybe try to remove the useless Variables? D: xD

example. You don't need "on join" events and "on quit" just do this simple. and smaller. and effiferzen

code_language.skript:
command /mute [<player>]:
    trigger:
        if arg-1 is not set:
            send "&cWho do you wan't mute?"
        else:
            if {Mute::%arg-1%} is set:
                send "&cHe is already muted?"
            else:
                set {Mute::%arg-1%} to true
                send "&cHe is now muted by you"
                send "&7You has been muted by %player%" to arg-1

command /unmute [<player>]:
    trigger:
        if arg-1 is not set:
            send "&cWho do you wan't mute?"
        else:
            if {Mute::%arg-1%} is not set:
                send "&cHe is not muted?"
            else:
                delete {Mute::%arg-1%}
                send "&cHe is now unbemuted"
                send "&7You has been &cUN&7muted by %player%" to arg-1
     
on chat:
    if {Mute::%player%} is set:
        cancel event
         send "You can't chat somethings. you been muted!"

Yep, that would be clever. I don't think about that :emoji_grinning:. But the on join event has an smal anti-error function. So if you forgot to unmute somebody, the script will do this. If you add this to the script it will be a perfect mute system :emoji_slight_smile:
 
Yeah, thats the right way and this what @ChisleLP posted is a compact version of mine :emoji_slight_smile:.



Yep, that would be clever. I don't think about that :emoji_grinning:. But the on join event has an smal anti-error function. So if you forgot to unmute somebody, the script will do this. If you add this to the script it will be a perfect mute system :emoji_slight_smile:


Well. what is. if he got muted,and rejoin it. he can still agian write... :'D

he can do simple

code_language.skript:
command /mutelist:
    trigger:
        if {Mute::*} is set:
            send "List of Mute:"
            loop {Mute::*}:
                send "- %loop-index%"
         else:
             send "Wow. No one Muted?"
 
Status
Not open for further replies.