Levels won't work

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

Jul 18, 2023
25
0
1
16
Hi there! I made a Skript for my job-related server and you need levels to rank up. You need level 50 or higher to rank up with a certain job command. I'm level 54, and it says I have to be at least level 50 to do it (It means I'm not a high enough level even though I am.)

If y'all could help me, that'd be amazing.

Here is my code:

Code:
command /resetlevel <player>:
    permission: op
    trigger:
        set {level::%arg-1's uuid%} to 0
        send "&aPlayer's level successfully reset!" to player
        send "&cYour level has been reset by an admin! If this is abuse, contact the president immediately!" to arg-1
        set {doctor::%arg-1's uuid%} to false
        set {police::%arg-1's uuid%} to false
command /jobdoctor <player>:
    permission: op
    trigger:
        if {doctor::%arg-1's uuid%} is false:
            if {level::%arg-1's uuid%} is greater than 9:
                execute console command "lp user %arg-1% parent set medic"
                send "&aSuccessfully ranked to: &f&lDOCTOR" to arg-1
                execute console command "kit medic %arg-1%"
                set {doctor::%arg-1's uuid%} to true
            else:
                send "&cYou must be level 10 or higher to do this!" to arg-1
        else:
            send "&cYou already are a doctor!" to arg-1
            
command /level:
    trigger:
        send "&aYou are: &eLevel %{level::%player's uuid%}%"
command /jobpolice <player>:
    permission: op
    trigger:
        if {police::%arg-1's uuid%} is false:
            if {level::%arg-1's uuid%} is greater than 49:
                execute console command "lp user %arg-1% parent set police"
                send "&aSuccessfully ranked to: &9&lPolice" to arg-1
                execute console command "kit police %arg-1%"
                set {police::%arg-1's uuid%} to true
 
Hi there! I made a Skript for my job-related server and you need levels to rank up. You need level 50 or higher to rank up with a certain job command. I'm level 54, and it says I have to be at least level 50 to do it (It means I'm not a high enough level even though I am.)

If y'all could help me, that'd be amazing.

Here is my code:

Code:
command /resetlevel <player>:
    permission: op
    trigger:
        set {level::%arg-1's uuid%} to 0
        send "&aPlayer's level successfully reset!" to player
        send "&cYour level has been reset by an admin! If this is abuse, contact the president immediately!" to arg-1
        set {doctor::%arg-1's uuid%} to false
        set {police::%arg-1's uuid%} to false
command /jobdoctor <player>:
    permission: op
    trigger:
        if {doctor::%arg-1's uuid%} is false:
            if {level::%arg-1's uuid%} is greater than 9:
                execute console command "lp user %arg-1% parent set medic"
                send "&aSuccessfully ranked to: &f&lDOCTOR" to arg-1
                execute console command "kit medic %arg-1%"
                set {doctor::%arg-1's uuid%} to true
            else:
                send "&cYou must be level 10 or higher to do this!" to arg-1
        else:
            send "&cYou already are a doctor!" to arg-1
           
command /level:
    trigger:
        send "&aYou are: &eLevel %{level::%player's uuid%}%"
command /jobpolice <player>:
    permission: op
    trigger:
        if {police::%arg-1's uuid%} is false:
            if {level::%arg-1's uuid%} is greater than 49:
                execute console command "lp user %arg-1% parent set police"
                send "&aSuccessfully ranked to: &9&lPolice" to arg-1
                execute console command "kit police %arg-1%"
                set {police::%arg-1's uuid%} to true
Try printing out the variable stats in chat (Ie: The level and police var) so you can double check the values you want are correct. Also, you can use ‘<= 50’ which means the same as greater than or equal to 50 (And is a little shorter). You can also set a player’s group with Skript and don’t have to use a console command for that (Set player’s group to example).
 
Also, why don't you use level bar for the levels. It helps with saving storage and is more visually responsive.
 
You can also display a "level" NBT tag on a scoreboard/level bar/action bar/title/bossbar, rather than variables.

Hell, you can store the player's job in an nbt tag, or a ram variable/metadata tag and just save it as nbt through restarts. Or you can just check the player's group since that's what you're using anyway.

if player's group is "medic" or if player's group is "police" should work. Requires Vault and a valid permission plugin (you have Luckperms just make sure you have Vault)

Also rather than setting the variable to false, just delete it delete {doctor::%player's uuid% to save storage space.