Any idea why this code isn't working?

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

    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.

mikkel20088

Member
Jan 8, 2021
1
0
1
The scripts is made to block even op players from using certain commands

So nothing below creates errors and the top part (/setspecial) works perfectly, but for some reason the bottom part of the script doesn't stop people who don't have the special permission from using manuadd.

Any idea why this isn't working for me?



Code:
command /setspecial [<offline player>]:
    trigger:
        if name of player is "N9cklas" or "mikkel20088":     
            if {special.%arg 1%} is true:
                set {special.%arg 1%} to false
                send "&7Du har &agivet &c%arg 1% &7 adgang til special commands" to player
            else:
                set {special.%arg 1%} to true
                send "&7Du har &cfjernet &7adgang til special commands fra &c%arg 1%" to player









on command "/manuadd":

    if player is op:
        if {special.player} is false:

            cancel event

            send "&cGlem det"

            stop

    if player has permission "*":
        if {special.player} is false:

            cancel event

            send "&cGlem det"

            stop
 
The scripts is made to block even op players from using certain commands

So nothing below creates errors and the top part (/setspecial) works perfectly, but for some reason the bottom part of the script doesn't stop people who don't have the special permission from using manuadd.

Any idea why this isn't working for me?



Code:
command /setspecial [<offline player>]:
    trigger:
        if name of player is "N9cklas" or "mikkel20088":   
            if {special.%arg 1%} is true:
                set {special.%arg 1%} to false
                send "&7Du har &agivet &c%arg 1% &7 adgang til special commands" to player
            else:
                set {special.%arg 1%} to true
                send "&7Du har &cfjernet &7adgang til special commands fra &c%arg 1%" to player









on command "/manuadd":

    if player is op:
        if {special.player} is false:

            cancel event

            send "&cGlem det"

            stop

    if player has permission "*":
        if {special.player} is false:

            cancel event

            send "&cGlem det"

            stop
Try replacing {special.player} to {special.%player%}.
As you can see in /setspecial, you used precentages for the arg-1 variable thing. So you should do the same in the group manger command
 
The scripts is made to block even op players from using certain commands

So nothing below creates errors and the top part (/setspecial) works perfectly, but for some reason the bottom part of the script doesn't stop people who don't have the special permission from using manuadd.

Any idea why this isn't working for me?



Code:
command /setspecial [<offline player>]:
    trigger:
        if name of player is "N9cklas" or "mikkel20088":    
            if {special.%arg 1%} is true:
                set {special.%arg 1%} to false
                send "&7Du har &agivet &c%arg 1% &7 adgang til special commands" to player
            else:
                set {special.%arg 1%} to true
                send "&7Du har &cfjernet &7adgang til special commands fra &c%arg 1%" to player









on command "/manuadd":

    if player is op:
        if {special.player} is false:

            cancel event

            send "&cGlem det"

            stop

    if player has permission "*":
        if {special.player} is false:

            cancel event

            send "&cGlem det"

            stop

In Skript, you almost always need to use arguments in your code. To use arguments, use:

%player% (which with a command refers to the person running the command. In Events, it refers to the player that is doing the Event,)
%arg-1% is the first argument. Some examples of arguments: [<text>], [<player>], [<offlineplayer>]
When referring to an argument that is NOT the FIRST one, increase the "1" to what the argument is. (%arg-2%, or %arg-3%, etc.)

Basically what I am saying is replace "{special.player}" with "{special.%player%}"

It does seem you've used "{special.%arg-1%}" correctly, though.

Other than all of this, the code looks fine!
 
Status
Not open for further replies.