1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved List Variable Help

Discussion in 'Skript' started by CKR367, May 12, 2017.

Thread Status:
Not open for further replies.
  1. CKR367

    CKR367 Member

    Joined:
    Feb 1, 2017
    Messages:
    64
    Likes Received:
    2
    Hello, I am trying to create an achievement where if a player breaks 10 cobble, it displays a message, and adds the player to a list variable. For some reason, the player can get the achievement multiple times... Can someone help me? I am new to list variables, sorry.

    Code (Skript):
    1. on break:
    2.     if event-block is cobble:
    3.         if {achievement.bc::%player%} does not exist:
    4.             add 1 to {amount.bc.%player%}
    5.             if {amount.bc.%player%} is equal to 10:
    6.                 add event-player to {achievement.bc::*}
    7.                 delete {amount.bc.%player%}
    8.                 broadcast "&a%player% &7broke 10 cobble"
    9.                 stop
    Skript Version: Bensku Dev26f
    Addons: 1.11 SkQuery Lime (Latest), SkRayFall (Latest)


     
    #1 CKR367, May 12, 2017
    Last edited: May 12, 2017
  2. Best Answer:
    Post #6 by ShaneBee, May 12, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,123
    Likes Received:
    157
    Code (Skript):
    1. on break:
    2.     if event-block is cobble:
    3.         if {achievement.bc::%player%} is not set:
    4.             if {amount.bc.%player%} >= 10:
    5.                 add event-player to {achievement.bc::*}
    6.                 delete {amount.bc.%player%}
    7.                 broadcast "&a%player% &7broke 10 cobble"
    8.             else:
    9.                 add 1 to {amount.bc.%player%}
    10.         else:
    11.             send "%player% already broke 10 cobble"
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,123
    Likes Received:
    157
    Sadly, still displays the message that the player broke cobble several times. Thanks for the attempt though :emoji_thumbsup:
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,123
    Likes Received:
    157
    Uhm, lol. I'm not expert at variable haha but maybe this line is wrong.
    add event-player to {achievement.bc::*}
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,123
    Likes Received:
    157
    Nope :emoji_frowning: I tried player and event-player, no luck :emoji_frowning:
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,123
    Likes Received:
    157
    Code (Skript):
    1.  
    2. on break:
    3.     if event-block is cobble:
    4.         if {achievement.bc::%player%} is not set:
    5.             if {amount.bc.%player%} is not set:
    6.                 set {amount.bc.%player%} to 0
    7.             if {amount.bc.%player%} <= 8:
    8.                 add 1 to {amount.bc.%player%}
    9.             else:
    10.                 set {achievement.bc::%player%} to true
    11.                 send "You finished"
    12.                 delete {amount.bc.%player%}
    13.         else:
    14.             send "Already"
    15.  
    16. command /reset:
    17.     trigger:
    18.         delete {achievement.bc::*}
    Sorry I feel stupid :emoji_grinning:. But there you go. I testet it and work fine.
     
Thread Status:
Not open for further replies.
Loading...