/promote <player> [<arg 2>]

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

FusionCore

Supporter
Apr 19, 2020
44
1
8
18
command /promote [<player>] [<arg 2>]:
permission: op
trigger:
player is set:
arg 1 is set:
arg 2 is set:
if arg 2 is "default":
if {default::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {default::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {default::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "builder":
if {builder::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {builder::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {builder::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "developer":
if {developer::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {developer::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {developer::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "admin":
if {admin::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {admin::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {admin::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "coowner":
if {coowner::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {coowner::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {coowner::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "owner":
if {owner::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {owner::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {owner::*}
execute player command "resetchatformatting %arg 1%"
elif:
send "&7Sorry, you wrote this command wrong. Try again!" player
command /resetchatformatting [<player>]:
permission: op
trigger:
arg 1 is set:
if {default::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&7Default&8] &f%player%&7: &f%message%"
send "&8[&7Default&8] &f%arg 1%&7: &fHello World" to player
if {builder::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&aBuilder&7] &f%player%&7: &f%message%"
send "&7[&aBuilder&7] &f%arg 1%&7: &fHello World" to player
if {developer::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&bDeveloper&7] &f%player%&7: &f%message%"
send "&7[&bDeveloper&7] &f%arg 1%&7: &fHello World" to player
if {admin::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&cAdmin&7] &f%player%&7: &f%message%"
send "&7[&cAdmin&7] &f%arg 1%&7: &fHello World" to player
if {coowner::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&4Co-Owner&8] &f%player%&7: &f%message%"
send "&7[&4Co-Owner&7] &f%arg 1%&7: &fHello World" to player
if {owner::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&4Owner&8] &f%player%&7: &f%message%"
send "&8[&4Owner&8] &f%arg 1%&7: &fHello World" to player

Do you know what I'm doing wrong?
 
command /promote [<player>] [<arg 2>]:
permission: op
trigger:
player is set:
arg 1 is set:
arg 2 is set:
if arg 2 is "default":
if {default::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {default::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {default::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "builder":
if {builder::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {builder::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {builder::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "developer":
if {developer::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {developer::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {developer::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "admin":
if {admin::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {admin::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {admin::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "coowner":
if {coowner::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {coowner::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {coowner::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "owner":
if {owner::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {owner::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {owner::*}
execute player command "resetchatformatting %arg 1%"
elif:
send "&7Sorry, you wrote this command wrong. Try again!" player
command /resetchatformatting [<player>]:
permission: op
trigger:
arg 1 is set:
if {default::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&7Default&8] &f%player%&7: &f%message%"
send "&8[&7Default&8] &f%arg 1%&7: &fHello World" to player
if {builder::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&aBuilder&7] &f%player%&7: &f%message%"
send "&7[&aBuilder&7] &f%arg 1%&7: &fHello World" to player
if {developer::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&bDeveloper&7] &f%player%&7: &f%message%"
send "&7[&bDeveloper&7] &f%arg 1%&7: &fHello World" to player
if {admin::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&cAdmin&7] &f%player%&7: &f%message%"
send "&7[&cAdmin&7] &f%arg 1%&7: &fHello World" to player
if {coowner::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&4Co-Owner&8] &f%player%&7: &f%message%"
send "&7[&4Co-Owner&7] &f%arg 1%&7: &fHello World" to player
if {owner::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&4Owner&8] &f%player%&7: &f%message%"
send "&8[&4Owner&8] &f%arg 1%&7: &fHello World" to player

Do you know what I'm doing wrong?
basically, everything
 
command /promote [<player>] [<arg 2>]:
permission: op
trigger:
player is set:
arg 1 is set:
arg 2 is set:
if arg 2 is "default":
if {default::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {default::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {default::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "builder":
if {builder::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {builder::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {builder::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "developer":
if {developer::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {developer::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {developer::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "admin":
if {admin::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {admin::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {admin::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "coowner":
if {coowner::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {coowner::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {coowner::*}
execute player command "resetchatformatting %arg 1%"
if arg 2 is "owner":
if {owner::*} contains %arg 1%'s uuid:
send "&b%arg 1% already has this rank!" to player
if {owner::*} does not contain %arg 1%'s uuid:
add %arg 1%'s uuid to {owner::*}
execute player command "resetchatformatting %arg 1%"
elif:
send "&7Sorry, you wrote this command wrong. Try again!" player
command /resetchatformatting [<player>]:
permission: op
trigger:
arg 1 is set:
if {default::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&7Default&8] &f%player%&7: &f%message%"
send "&8[&7Default&8] &f%arg 1%&7: &fHello World" to player
if {builder::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&aBuilder&7] &f%player%&7: &f%message%"
send "&7[&aBuilder&7] &f%arg 1%&7: &fHello World" to player
if {developer::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&bDeveloper&7] &f%player%&7: &f%message%"
send "&7[&bDeveloper&7] &f%arg 1%&7: &fHello World" to player
if {admin::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&7[&cAdmin&7] &f%player%&7: &f%message%"
send "&7[&cAdmin&7] &f%arg 1%&7: &fHello World" to player
if {coowner::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&4Co-Owner&8] &f%player%&7: &f%message%"
send "&7[&4Co-Owner&7] &f%arg 1%&7: &fHello World" to player
if {owner::*} contains %arg 1%'s uuid:
set %arg 1%'s chat format to "&8[&4Owner&8] &f%player%&7: &f%message%"
send "&8[&4Owner&8] &f%arg 1%&7: &fHello World" to player

Do you know what I'm doing wrong?
I've fixed it.
Here's the code. I've removed the ''/resetchatformatting'' from ''your code'' because there's no way to set a chat format per player.
Also, read the doc's, please.
Code:
command /promote [<offline player>] [<text>]:
    permission message: &cNo permissions.
    permission: op
    trigger:
        if arg 1 is set:
            if {uuid.%arg 1%} is set:
                if arg 2 is set:
                    if arg 2 is "default":
                        if {default::*} contains {uuid.%arg-1%}:
                            send "&b%arg 1% already has this rank!" to player
                        else:
                            remove {uuid.%arg-1%} from {builder::*}
                            remove {uuid.%arg-1%} from {developer::*}
                            remove {uuid.%arg-1%} from {admin::*}
                            remove {uuid.%arg-1%} from {coowner::*}
                            remove {uuid.%arg-1%} from {owner::*}

                            add {uuid.%arg-1%} to {default::*}

                    else if arg 2 is "builder":
                        if {builder::*} contains {uuid.%arg-1%}:
                            send "&b%arg 1% already has this rank!" to player
                        else:
                            remove {uuid.%arg-1%} from {default::*}
                            remove {uuid.%arg-1%} from {developer::*}
                            remove {uuid.%arg-1%} from {admin::*}
                            remove {uuid.%arg-1%} from {coowner::*}
                            remove {uuid.%arg-1%} from {owner::*}

                            add {uuid.%arg-1%} to {builder::*}

                    else if arg 2 is "developer":
                        if {developer::*} contains {uuid.%arg-1%}:
                            send "&b%arg 1% already has this rank!" to player
                        else:
                            remove {uuid.%arg-1%} from {default::*}
                            remove {uuid.%arg-1%} from {builder::*}
                            remove {uuid.%arg-1%} from {admin::*}
                            remove {uuid.%arg-1%} from {coowner::*}
                            remove {uuid.%arg-1%} from {owner::*}

                            add {uuid.%arg-1%} to {developer::*}

                    else if arg 2 is "admin":
                        if {admin::*} contains {uuid.%arg-1%}:
                            send "&b%arg 1% already has this rank!" to player
                        else:
                            remove {uuid.%arg-1%} from {default::*}
                            remove {uuid.%arg-1%} from {builder::*}
                            remove {uuid.%arg-1%} from {developer::*}
                            remove {uuid.%arg-1%} from {coowner::*}
                            remove {uuid.%arg-1%} from {owner::*}

                            add {uuid.%arg-1%} to {admin::*}

                    else if arg 2 is "coowner":
                        if {coowner::*} contains {uuid.%arg-1%}:
                            send "&b%arg 1% already has this rank!" to player
                        else:
                            remove {uuid.%arg-1%} from {default::*}
                            remove {uuid.%arg-1%} from {builder::*}
                            remove {uuid.%arg-1%} from {developer::*}
                            remove {uuid.%arg-1%} from {admin::*}
                            remove {uuid.%arg-1%} from {owner::*}

                            add {uuid.%arg-1%} to {coowner::*}

                    else if arg 2 is "owner":
                        if {owner::*} contains {uuid.%arg-1%}:
                            send "&b%arg 1% already has this rank!" to player
                        else:
                            remove {uuid.%arg-1%} from {default::*}
                            remove {uuid.%arg-1%} from {builder::*}
                            remove {uuid.%arg-1%} from {developer::*}
                            remove {uuid.%arg-1%} from {admin::*}
                            remove {uuid.%arg-1%} from {coowner::*}

                            add {uuid.%arg-1%} to {owner::*}
                    else:
                        send "&7Sorry, you wrote this command wrong. Try again!"
                        send "&7Usage: &c/promote <player> <rank>"
                else:
                    send "&7Sorry, you wrote this command wrong. Try again!"
                    send "&7Usage: &c/promote <player> <rank>"
            else:
                send "&cThis player hasn't played on the server."
        else:
            send "&7Sorry, you wrote this command wrong. Try again!"
            send "&7Usage: &c/promote <player> <rank>"

on chat:
    cancel event
    loop all players:
        if {default::*} contains {uuid.%sender%}:
            send "&8[&7Default&8] &f%sender%&7: &f%message%" to loop-player

        else if {builder::*} contains {uuid.%sender%}:
            send "&7[&aBuilder&7] &f%sender%&7: &f%message%" to loop-player

        else if {developer::*} contains {uuid.%sender%}:
            send "&7[&bDeveloper&7] &f%sender%&7: &f%message%" to loop-player

        else if {admin::*} contains {uuid.%sender%}:
            send "&7[&cAdmin&7] &f%sender%&7: &f%message%" to loop-player

        else if {coowner::*} contains {uuid.%sender%}:
            send "&8[&4Co-Owner&8] &f%sender%&7: &f%message%" to loop-player

        else if {owner::*} contains {uuid.%sender%}:
            send "&8[&4Owner&8] &f%sender%&7: &f%message%" to loop-player

on join:
    if {uuid.%player%} is not set:
        set {uuid.%player%} to player's uuid
        add {uuid.%player%} to {default::*}

Proof it works: https://gyazo.com/1712d3b404c4bde0a90908c75fcace9d
 
Best to make a function for this so the code wont look so long or messy..
 
Status
Not open for further replies.