Solved Spec Skript Fix/Request

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

PotteryTNT

Member
Jul 21, 2017
41
0
0
22
Category: UHC

What I want: Ok so, I have a skript that allows the person doing the command to put anyone and themselves in spectator mode. However, I would like to make it so if they do /spec, they are put into spec but cannot put anyone else into spec. Then I would like another permission being made if possible to put other people in spec (/spec <name>) then at the end, /unspec and /unspec <name> or /spec and /spec <name> again will take them out of spec.

Ideas for commands: listed above

Ideas for permissions: first permission spec.op, second permission spectate.op

When I'd like it by: possibly this or next week

The current skript i have: https://pastebin.com/Qi9Uus2w
 
I haven't tested it but the parser says everything should work fine. I don't know if I have made any dumb mistakes but i hope not haha
code_language.skript:
command /spec [<player>]:
    trigger:
        if arg-1 is set:
            if arg-1 is player:
                if arg-1's gamemode is not spectator:
                    set arg-1's gamemode to spectator
                    send "&cYou have set %arg-1%'s gamemode to spectator!"
                    send "Your gamemode has been changed to spectator" to arg-1
                else:
                    set arg-1's gamemode to survival
                    send "&cYou have set %arg-1%'s gamemode to survival!"
                    send "Your gamemode has been changed to survival" to arg-1
            else:
                if player has permission "spec.other":
                    if arg-1's gamemode is not spectator:
                        set arg-1's gamemode to spectator
                        send "&cYou have set %arg-1%'s gamemode to spectator!"
                        send "Your gamemode has been changed to spectator" to arg-1
                    else:
                        set arg-1's gamemode to survival
                        send "&cYou have set %arg-1%'s gamemode to survival!"
                        send "Your gamemode has been changed to survival" to arg-1
        else:
            if player has permission "spec.other":
                send "Please insert your other someone others name"
            else:
                if arg-1's gamemode is not spectator:
                    set arg-1's gamemode to spectator
                    send "&cYou have set %arg-1%'s gamemode to spectator!"
                    send "Your gamemode has been changed to spectator" to arg-1
                else:
                    set arg-1's gamemode to survival
                    send "&cYou have set %arg-1%'s gamemode to survival!"
                    send "Your gamemode has been changed to survival" to arg-1