Jump to content

How to format chat with Skript.


Recommended Posts

M I N E H U T  C O M M U N I T Y  F A Q

HOW TO FORMAT CHAT WITH SKRIPT

REQUIREMENTS: Skript
DIFFICULTY: MEDIUM

Introduction:

For the following tutorial, it is assumed that the reader has a basic knowledge of how to set up a server, install a plugin on said server and join it. It is also assumed that the reader has basic file manipulation skills within the Minehut File Manager, as well a moderate knowledge of the plugin 'Skript'.

The plugin Skript is a great way to modify your server on Minehut. It is incredibly versatile and you can do almost anything with it. An example of this is formatting chat, which I will be focussing on today.

How to format chat:

To format chat, the 'chat format' expression inside of the 'on chat' event can be used. A very basic example of this could entail:

on chat:
  set the chat format to "%player% said %message%"

here we use %player% to represent the player chatting and %message% to represent the message the player sends. You can include color codes such as '&3' or hex codes such as '<##ff00fff>', your chat message can say whatever you want it to say.

You can also use something like this to merge your Skript chat format with your permission plugin's prefix:

on chat:
  if player is op:
    set the chat format to "%player's display name%&f: %message%"
  else:
    set the chat format to "%player's display name%&7: %message%"

Require further assistance?:

If you need more help on this topic, head over to this section of forums, or join our Discord!

📎 https://youtu.be/3avLji1hwtk

 

Compiled by the Minehut Staff Team

Edited by Migins
  • Like 2
  • Thanks 1

Support  July 29, 2020 → November 3, 2020

► Helper November 3, 2020 → February 22, 2021

► Moderator February 22, 2021 → Present

 I might not always respond to forum dms, however I am always contactable on discord (mig#0069)

Screen Shot 2020-03-20 at 5.23.33 pm.png

Link to post
Share on other sites
  • muelr changed the title to How to format chat with Skript.
  • 4 months later...
30 minutes ago, Heheheh9383738 said:

Hey! How can i set own permission for more ranks?

If player has permission: skript.chat.member

doesnt work :c

Try doing this:

if player has permission "skript.chat.member":
  [code]

 

  • Like 1

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to post
Share on other sites

Thats my code but it wont work :c

So i can reload it without errors but the code doesnt work

on join:
    if player do not have permission "{skript.owner}":
        if player doesn't have permission "{skript.admin}":
            if player doesn't have permission "{skript.staff}":
                if player doesn't have permission "{skript.vip}":
                    set {rank.%player%} to "&7&lMEMBER"
                else:
                    set {rank.%player%} to "&b&lVIP"
            else:
                set {rank.%player%} to "&a&lSTAFF"
        else:
            set {rank.%player%} to "&c&lADMIN"
    else:
        set {rank.%player%} to "&6&lOWNER"

on chat:
    set chat format to "%{rank.%player%}% &8x &f%player% &8» &7%message%"

Edited by Heheheh9383738
Link to post
Share on other sites

Try this:

on join:
    set {_uuid} to player's uuid
    if player does not have the permission "skript.owner":
        if player does not have the permission "skript.admin":
            if player does not have the permission "skript.staff":
                if player does not have the permission "skript.vip":
                    set {rank.%{_uuid}%} to "&7&lMEMBER"
                else:
                    set {rank.%{_uuid}%} to "&b&lVIP"
            else:
                set {rank.%{_uuid}%} to "&a&lSTAFF"
        else:
            set {rank.%{_uuid}%} to "&c&lADMIN"
    else:
        set {rank.%{_uuid}%} to "&6&lOWNER"

on chat:
    set chat format to "%{rank.%{_uuid}%}% &8x &f%player's displayname% &8» &7%message%"

I have not tested this out but in principal it should work. If there are any errors let me know

If I have helped you out in your post or you liked what I posted, please upvote and react to my post! It helps me a lot!

Some Minehut Links:

Server Rules • Staff Applications • News & Updates • Reports • Appeals


Minehut: VIP (07/04/2021 --> Current)
Elestra/Versa Realms: Manager (12/04/2021 --> Current)

If you have any questions contact me!
My Discord: BanditEagle#2481
My Spigot Profile: https://www.spigotmc.org/members/banditeagle.935281/
My IGN: BanditEagle

Link to post
Share on other sites
On 4/16/2021 at 12:36 PM, Heheheh9383738 said:

Thats my code but it wont work :c

So i can reload it without errors but the code doesnt work

on join:
    if player do not have permission "{skript.owner}":
        if player doesn't have permission "{skript.admin}":
            if player doesn't have permission "{skript.staff}":
                if player doesn't have permission "{skript.vip}":
                    set {rank.%player%} to "&7&lMEMBER"
                else:
                    set {rank.%player%} to "&b&lVIP"
            else:
                set {rank.%player%} to "&a&lSTAFF"
        else:
            set {rank.%player%} to "&c&lADMIN"
    else:
        set {rank.%player%} to "&6&lOWNER"

on chat:
    set chat format to "%{rank.%player%}% &8x &f%player% &8» &7%message%"

You don't need to make the permission a variable 

you can make it like 

on chat:
  If player has permission "skript.owner":
	set {rank.%player's uuid%} to "&8&l[&c&lOwner&8&l]"
	set the chat format to "%{rank.%player's uuid%}% %player's display name% &c>> &7%message%"

 

Rank V.I.P

Name - TutoFarm  / ShibaTheDoggo

I got less friends 😔

 

 

rank.png

Link to post
Share on other sites
1 hour ago, ShibaTheDoggo said:

You don't need to make the permission a variable 

you can make it like 


on chat:
  If player has permission "skript.owner":
	set {rank.%player's uuid%} to "&8&l[&c&lOwner&8&l]"
	set the chat format to "%{rank.%player's uuid%}% %player's display name% &c>> &7%message%"

 

Bad.

Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...