help with wantedlevel is not an entity type

Discussion in 'Skript' started by TadassLtt, Jul 18, 2018.

  1. hey guys need help with this

    Code (Text):
    command /wantedlvl [<player>]:
        trigger:
            if arg 1 is not set:
                message "&fUse: &b- /wantedlvl [nick]"
            if arg 1 is set:
                message "&b%arg 1% &fhas &b%{wantedlevel.%arg 1%}% &fwanted level!"
            if {wantedlevel.%arg 1%} is not set:
                set {wantedlevel.%arg 1%} to 0
    on death:
        victim is a player:
            attacker is a player:
                add 10 to {wantedlevel.%attacker%}
            if {wantedlevel.%player%} is 52
            execute console command "/jail %player% jailname 10"
    error: 'if {wantedlevel.%player%}' is not an entity type
     
  2. You don't have semicolon :)) character at the end of the line with the second if. Like if I helped :)
     
  3. First, don't ask for likes. It makes you look bad

    Use this code:
    Code (Text):
    command /wantedlvl [<player>]:
        trigger:
            if arg 1 is not set:
                message "&fUse: &b- /wantedlvl [nick]"
            else if arg 1 is set:
                message "&b%arg 1% &fhas &b%{wantedlevel.%arg 1%}% &fwanted level!"
            if {wantedlevel.%arg 1%} is not set:
                set {wantedlevel.%arg 1%} to 0
    on death of player:
        attacker is a player:
            add 10 to {wantedlevel.%attacker%}
            if {wantedlevel.%attacker%} is 52:
             execute console command "/jail %attacker% jailname 10"
    Btw please replace all your dots (.) with double colons ( :: ), because it is more useful (see down below). If you want to store the wanted level of a player forever, use %uuid of player% and %uuid of attacker%, because if the player changes the name and another player gets that name, it will set the wantedlevel of another player.

    In death events there are no players, so you can use %attacker% or %victim%

    Optimal code (with :: variables)

    Code (Text):
    command /wantedlvl [<offlineplayer>]:
        trigger:
            if arg 1 is not set:
                message "&fUse: &b- /wantedlvl [nick]"
            else if arg 1 is set:
                message "&b%arg 1% &fhas &b%{wantedlevel::%uuid of arg 1%}% &fwanted level!"
            if {wantedlevel::%uuid of arg 1%} is not set:
                set {wantedlevel::%uuid of arg 1%} to 0
    on death of player:
        attacker is a player:
            add 10 to {wantedlevel::%uuid of attacker%}
            if {wantedlevel::%uuid of attacker%} is 52:
             execute console command "/jail %attacker% jailname 10"
    Why should you use :: instead of .?
    Because you can clear it more easier
    instead of
    Code (Text):
    loop all players:
        delete {wantedlvl.%loop-player%}
    and not deleting all player data

    you can use
    Code (Text):
    delete {wantedlvl::*}
     
    #3 Efnilite, Jul 18, 2018
    Last edited: Jul 19, 2018
    • Agree Agree x 1