Jump to content

Skript - Ranks


Motionq

Recommended Posts

The following skript is mainly chat related. I've attempted to update the tab, but the ways I've tried failed possibly due to the current version of Skript and the addons. Make sure that after you've reloaded the skript for the first time that everyone on the server relogs if you haven't set their ranks (it will basically apply default to them unless you want to do it manually).

 

on first join:
    set {rank::%UUID of player%} to "default"

on join:
    if {rank::%UUID of player%} is not set:
        set {rank::%UUID of player%} to "default"

on chat:
    cancel event
    if {rank::%UUID of player%} is "admin":
        broadcast "&c[Admin] %player%&8: &f%message%"
    if {rank::%UUID of player%} is "mod":
        broadcast "&e[Mod] &e%player%&8: &f%message%"
    if {rank::%UUID of player%} is "jrmod":
        broadcast "&e[Jr.Mod] %player%&8: &f%message%"
    if {rank::%UUID of player%} is "default":
        broadcast "&7%player%&8: &7%message%"

command /setrank [<offlineplayer>] [<text>]:
    permission: skript.setrank
    permission message: &cYou may not use that command!
    trigger:
        if arg 1 is set:
            if arg 2 is set:
                if {rank::%UUID of arg 1%} is set:
                    if arg 2 is "admin":
                        set {rank::%UUID of arg 1%} to "admin"
                        send "&7You've set &a%arg 1%'s &7rank to &cAdmin"
                    if arg 2 is "mod":
                        set {rank::%UUID of arg 1%} to "mod"
                        send "&7You've set &a%arg 1%'s &7rank to &eMod"
                    if arg 2 is "jrmod":
                        set {rank::%UUID of arg 1%} to "jrmod"
                        send "&7You've set &a%arg 1%'s &7rank to &eJr.Mod"
                    if arg 2 is "default":
                        set {rank::%UUID of arg 1%} to "default"
                        send "&7You've set &a%arg 1%'s &7rank to &8Default"
                    else if arg 2 is not "admin", "mod", "jrmod" or "default":
                        send "&cThat is not a valid rank"
                else:
                    send "&cPlayer not found"
            else:
                send "&c/setrank <player> <rank>"
        else:
            send "&c/setrank <player> <rank>"

command /ranklist:
    permission: skript.ranklist
    permission message: &cYou may not use that command!
    usage: /ranklist
    trigger:
        send ""
        send "&3Rank List"
        send ""
        send "&c[Admin] &8- &7""admin"""
        send "&e[Mod] &8- &7""mod"""
        send "&e[Jr.Mod] &8- &7""jrmod"""
        send "&7Default &8- &7""default"""
        send ""

 

You can simply configure this and add on to it if you'd like. Keep in mind this is chat related so it doesn't include permissions, but if you'd like to use pex or something similar, just add "make console execute command "/pex user %arg 1% group set (group)" (you'd add that under all the "set {rank::%UUID of arg 1%} to "admin"" lines in the /setrank command), and obviously need to make the groups in pex but all you'd need to do is add permissions for certain ranks. If you need any help with that you can simply reply to this thread and I can assist you from there (make sure to include your skript in a pastbin or something similar).

  • Like 1
Link to comment
Share on other sites

👍

  • Like 1

Minehut Volunteer Moderator Helper

Discord: powerwinch

----------------------------------------------------------------------------

DD/MM/YYYY

[JR.MOD] 28/04/2019

[MOD] 28/07/2019

[SR.MOD] 01/09/2019

[PATRON] / [RESIGNED] 26/07/2020

[MOD] / [REINSTATED] 12/09/2020

[PATRON] / [RESIGNED] 31/10/2020

[MOD] / [REINSTATED] 25/02/2021

[<3] 09/06/2022

[HELPER] 29/11/2023

----------------------------------------------------------------------------

Y6cr20v.png

Link to comment
Share on other sites

2 minutes ago, Customable said:

because this is an extremely inefficient way of making ranks, and the code is pretty messy. but what ever floats your boat

We all have our own way of scripting, this seems to work out perfectly for me.

  • Like 1
Link to comment
Share on other sites

Logo wars, anyway I like the skript, personally however, I would configurate it a bit.

5236bc28278206fb51bee49dc55ad479.png

  • Thanks 1

Skripter, Builder, Server Owner, Certified Lizard Human.

2757740fb020b4d2a3d04e20ee371bf8.png.ec0bcd241c08d8e2355410a7a264c449.png

Discord: Nic_#0001 (As of 7/1/2021)

IGN: ItzNic_ (ALT: Nectoure)

Give me a moral boost and drop me a like plz ❤️

Link to comment
Share on other sites

3 minutes ago, ItzNic said:

Logo wars, anyway I like the skript, personally however, I would configurate it a bit.

5236bc28278206fb51bee49dc55ad479.png

Yeah, like I said I obviously skript differently than other people, but this is more or less a base for people to follow and configure for themselves. As long as it works they shouldn't care much lol 😉

Link to comment
Share on other sites

1 minute ago, Motionq said:

Yeah, like I said I obviously skript differently than other people, but this is more or less a base for people to follow and configure for themselves. As long as it works they shouldn't care much lol 😉

Yeah true, you have a point. Keep up the good work on those skriptssss!

  • Like 1

Skripter, Builder, Server Owner, Certified Lizard Human.

2757740fb020b4d2a3d04e20ee371bf8.png.ec0bcd241c08d8e2355410a7a264c449.png

Discord: Nic_#0001 (As of 7/1/2021)

IGN: ItzNic_ (ALT: Nectoure)

Give me a moral boost and drop me a like plz ❤️

Link to comment
Share on other sites

  • 1 month later...

Although some improvements can be made, nice script and it can be helpful to people that are new to skript.

The biggest suggestion for improvement i can give is using lists:

Make a list for the ranks and a separated list for the rank prefixes.

Doing so would save a lot of lines and also add the possibility of the players adding ranks and prefixes themselves to those lists with a command like /rank create (name) (prefix)

Link to comment
Share on other sites

  • 7 months later...

For the adding permissions im having trouble figuring out where to add them. This is the skript I have made so far: 

on first join:
    set {rank::%UUID of player%} to "default"

on join:
    if {rank::%UUID of player%} is not set:
        set {rank::%UUID of player%} to "default"

on chat:
    cancel event
    if {rank::%UUID of player%} is "owner":
        broadcast "&l&4[Owner] %player%&8: &f%message%"
    if {rank::%UUID of player%} is "admin":
        broadcast "&c[Admin] %player%&8: &f%message%"
    if {rank::%UUID of player%} is "mod":
        broadcast "&e[Mod] &e%player%&8: &f%message%"
    if {rank::%UUID of player%} is "jrmod":
        broadcast "&e[Jr.Mod] %player%&8: &f%message%"
    if {rank::%UUID of player%} is "default":
        broadcast "&7%player%&8: &7%message%"

command /setrank [<offlineplayer>] [<text>]:
    permission: skript.setrank
    permission message: &cYou may not use that command!
    trigger:
        if arg 1 is set:
            if arg 2 is set:
                if {rank::%UUID of arg 1%} is set:
                    if arg 2 is "owner":
                        set {rank::%UUID of arg 1%} to "owner"
                        send "&7You've set &a%arg 1%'s &7rank to &l&4Owner"
                        make console execute command "/pex user %arg 1% group set (owner)"
                    if arg 2 is "admin":
                        set {rank::%UUID of arg 1%} to "admin"
                        send "&7You've set &a%arg 1%'s &7rank to &cAdmin"
                        make console execute command "/pex user %arg 1% group set (admin)"
                    if arg 2 is "mod":
                        set {rank::%UUID of arg 1%} to "mod"
                        send "&7You've set &a%arg 1%'s &7rank to &eMod"
                        make console execute command "/pex user %arg 1% group set (mod)"
                    if arg 2 is "jrmod":
                        set {rank::%UUID of arg 1%} to "jrmod"
                        send "&7You've set &a%arg 1%'s &7rank to &eJr.Mod"
                        make console execute command "/pex user %arg 1% group set (jr.mod)"
                    if arg 2 is "default":
                        set {rank::%UUID of arg 1%} to "default"
                        send "&7You've set &a%arg 1%'s &7rank to &8Default"
                        make console execute command "/pex user %arg 1% group set (default)"
                    else if arg 2 is not "admin", "mod", "jrmod" or "default":
                        send "&cThat is not a valid rank"
                else:
                    send "&cPlayer not found"
            else:
                send "&c/setrank <player> <rank>"
        else:
            send "&c/setrank <player> <rank>"

command /ranklist:
    permission: skript.ranklist
    permission message: &cYou may not use that command!
    usage: /ranklist
    trigger:
        send ""
        send "&3Rank List"
        send ""
        send "&l&0[Owner] &8- &7""owner"""
        send "&c[Admin] &8- &7""admin"""
        send "&e[Mod] &8- &7""mod"""
        send "&e[Jr.Mod] &8- &7""jrmod"""
        send "&7Default &8- &7""default"""
        send ""

command /resetrank [<offlineplayer>] [<text>]:
    permission: skript.setrank
    permission message: &cYou may not use that command!
    trigger:
        if arg 1 is set:
            if arg 2 is set:
                if {rank::%UUID of arg 1%} is set:
                    if arg 2 is "owner":
                        set {rank::%UUID of arg 1%} to "default"
                        send "&7You've set &a%arg 1%'s &7rank to &l&4Default"
                    if arg 2 is "admin":
                        set {rank::%UUID of arg 1%} to "default"
                        send "&7You've set &a%arg 1%'s &7rank to &cDefault"
                    if arg 2 is "mod":
                        set {rank::%UUID of arg 1%} to "default"
                        send "&7You've set &a%arg 1%'s &7rank to &eDefault"
                    if arg 2 is "jrmod":
                        set {rank::%UUID of arg 1%} to "default"
                        send "&7You've set &a%arg 1%'s &7rank to &edefault"
                    if arg 2 is "default":
                        set {rank::%UUID of arg 1%} to "default"
                        send "&7You've set &a%arg 1%'s &7rank to &8Default"
                    else if arg 2 is not "admin", "mod", "jrmod" or "default":
                        send "&cThat is not a valid rank"
                else:
                    send "&cPlayer not found"
            else:
                send "&c/setrank <player> <rank>"
        else:
            send "&c/setrank <player> <rank>"
 

Link to comment
Share on other sites

options:
	# How to add ranks:
	#  "Rank || Rank Prefix" that means, if you want to add the rank "Owner" with the prefix "&4Owner", you have to add "Owner||&4Owner" to the list below, be sure the last comma is an "and"
	
	ranks: "Default||&7Player&7","VIP||&a[VIP]&7","Supporter||Sup","Moderator||Mod","Admin||Admin" and "Owner||Owner"


function getRank(n:string) :: string:
	set {_m::*} to {@ranks}
	loop {_m::*}:
		set {_s::*} to loop-value split at "||"
		return {_s::1} if {_s::1} is {_n}
	return ""
		
function getPrefix(n:string) :: string:
	set {_m::*} to {@ranks}
	loop {_m::*}:
		set {_s::*} to loop-value split at "||"
		return {_s::2} if {_s::1} is {_n}

function setRank(p:player,t:offlineplayer,n:string):
	set {_u} to uuid of {_t}
	set {_rank} to {rank::%{_u}%}
	if getRank({_n}) is "":
		send "This Rank does not exist" to {_p}
	else:
		if {_t} is online:
			set {rank::%{_u}%} to {_n}
			send "&7You've set &a%{_t}%&7's &7rank to %getPrefix({_n})%" to {_p}
		else:
			if {_t} has played before:
				set {rank::%{_u}%} to {_n}
				send "&7You've set &a%{_t}%&7's &7rank to %getPrefix({_n})%" to {_p}
			else:
				send "This player does not exist" to {_p}
		
on join:
	setRank(player,player,"default") if {rank::%player's uuid%} is not set

on chat:
	set chat format to "%getPrefix({rank::%player's uuid%})% %player%: &7%message%"	

command /setrank [<offlineplayer>] [<text>]:
	permission: skript.setrank
	permission message: &cYou may not use that command!
	trigger:
		if arg-2 is set:
			setRank(player,arg-1,arg-2)
		else:
			send "&7Usage: /setrank Player Rank"
			

command /ranklist:
	permission: skript.ranklist
	permission message: &cYou may not use that command!
	usage: /ranklist
	trigger:
		send ""
		send "&3Rank List"
		send ""
		set {_n::*} to {@ranks}
		loop {_n::*}:
			set {_s::*} to loop-value split by "||"
			send "%{_s::2}% &8- &7""%{_s::1}%"""
		send ""
		


		

 

Link to comment
Share on other sites

19 hours ago, Cookieez said:

Can you add a command for reseting the ranks? I tried to upgrade a player from a mod to a admin but now it says that the player is both a mod and a admin and i would like to reset that. Also if you could add a owner rank that would be great. 

Why would you bump a thread which hasn't been commented on in over a year? 🤨

First Joined: July 2015
VIP: January 2020
Jr.Mod: 1st April 2020
Mod: 16th July 2020

Info:

~ Skript Developer
~ Discord: @nicholxs#0001
~ Previous names: Nichxlxs, Deterno, iHaveSkills, Retrical

Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...
  • 9 months later...
2 hours ago, scherpschutter2 said:

how can i make a rank can you send me the command for that?

Thx!

Hey! This post is over a year old. Please only comment on active threads (with less than a month since the last comment).

Locked for Necroposting 🔒

Discord: thistle#1234
In Game: thistl

Minehut Community Support Member
(8/10/19)
Minehut Junior Moderator

(10/30/19)
Minehut Moderator
(12/30/19 - 07/11/20)
Reinstated
(09/19/20)

❤️

(05/19/21)

 

Link to comment
Share on other sites

  • thistl locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...