#Suffix Skript

1 messages · Page 1 of 1 (latest)

naive plaza
#

I have a suffix skript I rn Im trying to code it so if you have a paper named "Random Suffix Token" you should get the permission to the random selected suffix and it should be added to a list that you wont get a duplicate. For some reason its not working.

    if event-item is {server_suffix_paper}:
        if {_randomsuffix} is not in {player::%player%::suffixes::*}:
            set {_randomsuffix} to random element of {suffix::permission::*}
            execute console command "lp user %player% permission set %{_randomsuffix}% true"
            add {_randomsuffix} to {player::%player%::suffixes::*}
            message "Hallo"
        else if {_randomsuffix} is in {player::%player%::suffixes::*}:
            send "{@prefix} You already own the selected suffix"
            message "Tschüs"```
sick dune
#

can you be more specific than "not working"?

#

also, you are using a local variable in if statements before defining it

naive plaza
#

like I spammed right click like 1000 times and it still says "hello"

naive plaza
#
    if event-item is {server_suffix_paper}:
        set {randomsuffix} to random element of {suffix::permission::*}
        if {randomsuffix} is not in {player::%player%::suffixes::*}:
            set {randomsuffix} to random element of {suffix::permission::*}
            execute console command "lp user %player% permission set %{_randomsuffix}% true"
            add {randomsuffix} to {player::%player%::suffixes::*}
        if {player::%player%::suffixes::*} contains {randomsuffix}:
            send "{@prefix} You already own the selected suffix"
            message "Tschüs"```
sick dune
#

why dont you just define it first

naive plaza
sick dune
naive plaza
#

í send the new code

sick dune
#

yes, but I want you to go back to the old code

sick dune
naive plaza
#

oh lol

#

forgot the delet the old one

naive plaza
sick dune
#

send the code

naive plaza
#
    if event-item is {server_suffix_paper}:
        set {randomsuffix} to random element of {suffix::permission::*}
        if {randomsuffix} is not in {player::%player%::suffixes::*}:
            execute console command "lp user %player% permission set %{randomsuffix}% true"
            add {randomsuffix} to {player::%player%::suffixes::*}
        if {player::%player%::suffixes::*} contains {randomsuffix}:
            send "{@prefix} You already own the selected suffix (%{randomsuffix}%)"
            message "Tschüs"
                
command getsuffixpaper:
    trigger:
        give player {server_suffix_paper}
        
command deletsuffixes:
    trigger:
        delete {player::%player%::suffixes::*}
        message "{@prefix} Deleted Suffixes"    ```
#

I get the suffixes but I also get the message That i already own this

#

probably because its added at the start and the is registered as in list

sick dune
#

okay so use an else if then

#

also, use UUIDs in variables

#

%player% -> %player's UUID%

naive plaza
sick dune
#
  1. Send the code or I cant see any errors
  2. go back to local variables
naive plaza
naive plaza
sick dune
#

Not as an attachment

#

Im on mobile, i cant open

#

Code block

naive plaza
#
    if event-item is {server_suffix_paper}:
        set {randomsuffix} to random element of {suffix::permission::*}
        if {randomsuffix} is not in {player::%player's uuid%::suffixes::*}:
            execute console command "lp user %player% permission set %{randomsuffix}% true"
            add {randomsuffix} to {player::%player's uuid%::suffixes::*}
            message "{@prefix} Added %{randomsuffix}%"
        else if {player::%player's uuid%::suffixes::*} contains {randomsuffix}:
            send "{@prefix} You already own the selected suffix (%{randomsuffix}%)"
            message "Tschüs"
                
command getsuffixpaper:
    trigger:
        give player {server_suffix_paper}
        
command deletsuffixes:
    trigger:
        delete {player::%player's uuid%::suffixes::*}
        message "{@prefix} Deleted Suffixe```
sick dune
#

Its your if statement

#

Instead of a is not in b it should be b does not contain a

#

And change the else if to just else

naive plaza