Solved Suffix skript

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

KyTDK

New Member
Oct 9, 2018
8
0
0
20
I would like a skript for when you type "/suffix s" it will have an s at the end of your name. I am using Pex and essentials chat. I also want it so players can only do one work like "/suffix hi_u" not "/suffix hi u". I want the permission to be suffix.set. I also want it to automatically put a space between the name so it looks like this "KyTDK s" not "KyTDKs". I would like this skript done by today since I just launched this new rank and its popping like a god church. And when you do "/suffix off" it turn off the suffix but if you do "/suffix offs" it wont turn it off. Please send the download links and requirements for this skript. Thank you (Ps some players already have a prefix and suffix from Pex so if you could tie that in so it works that would be great)
 
I hope this does the job (I also added extra color support, tell me if you don't want that and I'll remove it):
code_language.skript:
on chat:
    {suffix::%uuid of player%} is set
    set {_l::*} to split chat format at "[player]"
    set {_l2::*} to split {_l::1} at ""
    set {_c} to "&r"
    loop {_l2::*}:
        set {_i} to loop-index parsed as a integer
        set {_i2} to {_i} + 1
        loop-value is "&" or "§"
        set {_c} to colored "&%{_l2::%{_i2}%}%"
    replace every "[player]" in chat format with "[player] %{suffix::%uuid of player%}%%{_c}%"
    
command /suffix <text>:
    permission: suffix.set
    trigger:
        if arg-1 is "off":
            delete {suffix::%uuid of player%}
            message "&aSuffix deleted!"
        else if arg-1 contains " ":
            message "&cYou're suffix can't have spaces!"
            stop
        else:
            set {suffix::%uuid of player%} to colored arg-1
            message "&aSuffix set!"
 
I hope this does the job (I also added extra color support, tell me if you don't want that and I'll remove it):
code_language.skript:
on chat:
    {suffix::%uuid of player%} is set
    set {_l::*} to split chat format at "[player]"
    set {_l2::*} to split {_l::1} at ""
    set {_c} to "&r"
    loop {_l2::*}:
        set {_i} to loop-index parsed as a integer
        set {_i2} to {_i} + 1
        loop-value is "&" or "§"
        set {_c} to colored "&%{_l2::%{_i2}%}%"
    replace every "[player]" in chat format with "[player] %{suffix::%uuid of player%}%%{_c}%"
   
command /suffix <text>:
    permission: suffix.set
    trigger:
        if arg-1 is "off":
            delete {suffix::%uuid of player%}
            message "&aSuffix deleted!"
        else if arg-1 contains " ":
            message "&cYou're suffix can't have spaces!"
            stop
        else:
            set {suffix::%uuid of player%} to colored arg-1
            message "&aSuffix set!"
Thank you I was meant to mention that
[doublepost=1541708852,1541708546][/doublepost]@TPGamesNL There was an error loads that skript
2018-11-09_07.25.50.png
 
What skript version and mc version are you using?
 
You need at least dev31 for this script
 
@TPGamesNL Can you make a character limit on the skript please and make it so it doesn't count color codes.
edit the maximum in line 22
code_language.skript:
on chat:
    {suffix::%uuid of player%} is set
    set {_l::*} to split chat format at "[player]"
    set {_l2::*} to split {_l::1} at ""
    set {_c} to "&r"
    loop {_l2::*}:
        set {_i} to loop-index parsed as a integer
        set {_i2} to {_i} + 1
        loop-value is "&" or "§"
        set {_c} to colored "&%{_l2::%{_i2}%}%"
    replace every "[player]" in chat format with "[player] %{suffix::%uuid of player%}%%{_c}%"
  
command /suffix <text>:
    permission: suffix.set
    trigger:
        if arg-1 is "off":
            delete {suffix::%uuid of player%}
            message "&aSuffix deleted!"
        else if arg-1 contains " ":
            message "&cYou're suffix can't have spaces!"
            stop
        else if length of uncolored arg-1 > 10:
            message "&cThe suffix is too long!"
            stop
        else:
            set {suffix::%uuid of player%} to colored arg-1
            message "&aSuffix set!"