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.

Help with a "shop" script

Discussion in 'Skript' started by AndersenGaming, Jul 9, 2019.

  1. A

    Joined:
    Jan 28, 2017
    Messages:
    2
    Likes Received:
    0
    Hello, I am starting to script again after a few years, and I am pretty new to this again.. I want to create a little "shop" in a NPC, for my server. If anyone could help me out with this script it would be very nice!
    See this picture with errors when trying to load script. [​IMG]
    There's only this in console:
    09.07 23:10:07 [Server] INFO UserName issued server command: /sk reload fiskemain1

    Code (Text):
    1. command /fisker:
    2.     trigger:
    3.         wait 1 tick
    4.         open chest with 1 rows named "&9&lFisker" to player
    5.         format slot 3 of player with 1 of green wool named "&2&lKøb" with lore "&3Køb fisk " to close then run [execute player command "/købfiskafmanden1232"]
    6.         format slot 5 of player with 1 of red wool named "&4&lSælg" with lore "&3Sælg fisk" to close then run [execute player command "/sælgfiskemanden123213"]  
    7.         stop
    8.        
    9. command /købfiskafmanden1232:
    10.     trigger:
    11.         wait 1 tick
    12.         open chest with 1 rows named "&9&lVælg fisk" to player
    13.         format slot 3 of player with 1 of cooked fish named "&3Stegt fisk" to close then run [execute player command "/købstegtfiskafmanden1232"]
    14.         format slot 5 of player with 1 of cooked salmon named "&3Stegt laks" to close then run [execute player command "/købstegtlaksfiskemanden123213"]
    15.         format slot 7 of player with 1 of pufferfish named "&3Kuglefisk" to close then run [execute player command "/købkuglefiskfiskemanden123213"]      
    16.         stop
    17.    
    18. command /købstegtfiskafmanden1232:
    19.     trigger:
    20.         open chest with 1 rows named "&9&lKøb stegt fisk" to player
    21.         format slot 3 of player with 1 of cooked fish named "&2$50" with lore "&3Køb 1 stegt fisk" to close then run [execute player command "/køb1stegtfiskafmanden1232"]
    22.         format slot 5 of player with 8 of cooked fish named "&2$400" with lore "&3Køb 8 stegte fisk" to close then run [execute player command "/køb8stegtfiskafmanden1232"]
    23.         format slot 7 of player with 16 of cooked fish named "&2$800" with lore "&3Køb 16 stegte fisk" to close then run [execute player command "/køb16stegtfiskafmanden1232"]
    24.         stop
    25.        
    26. command /købstegtlaksfiskemanden123213:
    27.     trigger:
    28.         open chest with 1 rows named "&9&lKøb stegt laks" to player
    29.         format slot 3 of player with 1 of cooked salmon named "&2$60" with lore "&3Køb 1 stegt laks" to close then run [execute player command "/køb1stegtlaksafmanden1232"]
    30.         format slot 5 of player with 8 of cooked salmon named "&2$480" with lore "&3Køb 8 stegte laks" to close then run [execute player command "/køb8stegtlaksafmanden1232"]
    31.         format slot 7 of player with 16 of cooked salmon named "&2$960" with lore "&3Køb 16 stegte laks" to close then run [execute player command "/køb16stegtlaksafmanden1232"]
    32.         stop  
    33.        
    34. command /købkuglefiskfiskemanden123213:
    35.     trigger:
    36.         open chest with 1 rows named "&9&lKøb kuglefisk" to player
    37.         format slot 3 of player with 1 of Pufferfish named "&2$35" with lore "&3Køb 1 kuglefisk" to close then run [execute player command "/køb1kuglefiskafmanden1232"]
    38.         format slot 5 of player with 8 of Pufferfish named "&2$280" with lore "&3Køb 8 kuglefiske" to close then run [execute player command "/køb8kuglefiskafmanden1232"]
    39.         format slot 7 of player with 16 of Pufferfish named "&2$560" with lore "&3Køb 16 kuglefiske" to close then run [execute player command "/køb16kuglefiskafmanden1232"]      
    40.         stop
    41.        
    42. command /køb1stegtfiskafmanden1232:
    43.     trigger:
    44.       if player's balance >= 50:
    45.         give potato to player
    46.         subtract 50 from player's balance
    47.             message "&9Fisker &e> &4&lKøbte 1 stegt fisk."
    48.                   else:
    49.         message "&7Du har ikke nok penge."
    50.    
    51. command /køb8stegtfiskafmanden1232:
    52.     trigger:
    53.         if player's balance is greater than or equal to 400:
    54.             subtract 400 from player's balance
    55.             give player 8 of 350
    56.             message "&9Fisker &e> &4&lKøbte 8 stegte fisk."
    57.             stop      
    58.  
    59. command /køb16stegtfiskafmanden1232:
    60.     trigger:
    61.         if player's balance is greater than or equal to 800:
    62.             subtract 800 from player's balance
    63.             give player 16 of 350
    64.             message "&9Fisker &e> &4&lKøbte 16 stegte fisk."
    65.             stop  
    66.        
    67. command /køb1stegtlaksafmanden1232:
    68.     trigger:
    69.         if player's balance is greater than or equal to 60:
    70.             subtract 60 from player's balance
    71.             give player 1 of 350:1
    72.             message "&9Fisker &e> &4&lKøbte 1 stegt laks."
    73.             stop
    74.    
    75. command /køb8stegtlaksafmanden1232:
    76.     trigger:
    77.         if player's balance is greater than or equal to 480:
    78.             subtract 480 from player's balance
    79.             give player 8 of 350:1
    80.             message "&9Fisker &e> &4&lKøbte 8 stegte laks."
    81.             stop
    82.            
    83. command /køb16stegtlaksafmanden1232:
    84.     trigger:
    85.         if player's balance is greater than or equal to 960:
    86.             subtract 960 from player's balance
    87.             give player 16 of 350:1
    88.             message "&9Fisker &e> &4&lKøbte 16 stegte laks."
    89.             stop
    90.    
    91. command /køb1kuglefiskafmanden1232:
    92.     trigger:
    93.         if player's balance is greater than or equal to 35:
    94.             subtract 35 from player's balance
    95.             give player 1 of 349:3
    96.             message "&9Fisker &e> &4&lKøbte 1 kuglefisk."
    97.             stop
    98.    
    99. command /køb8kuglefiskafmanden1232:
    100.     trigger:
    101.         if player's balance is greater than or equal to 280:
    102.             subtract 280 from player's balance
    103.             give player 8 of 349:3
    104.             message "&9Fisker &e> &4&lKøbte 8 kuglefiske."
    105.             stop
    106.    
    107. command /køb8kuglefiskafmanden1232:
    108.     trigger:
    109.         if player's balance is greater than or equal to 560:
    110.             subtract 560 from player's balance
    111.             give player 16 of 349:3
    112.             message "&9Fisker &e> &4&lKøbte 16 kuglefiske."
    113.                
    114.  
    115.  
    --- Double Post Merged, Jul 9, 2019, Original Post Date: Jul 9, 2019 ---
    I just saw that my picture wouldn't work, so here is the picture.
     

    Attached Files:

    • skun.png
      skun.png
      File size:
      287.1 KB
      Views:
      11
  2. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,202
    Likes Received:
    69
    Medals:
    Use TuSKe (GUI manager) or vanilla Skript for GUI's
     
  3. PatoFrango

    PatoFrango Well-Known Member

    Joined:
    Jul 12, 2017
    Messages:
    115
    Likes Received:
    10
    What TPGamesNL said, and make sure you're actually using an economy plugin. The expression "player's balance" is only usable if you have one installed. There's no actual "player balance" feature by default in Skript, it's only used to communicate with the plugin.

    Some other things I noticed:
    • You don't need to stop the script every time you end a trigger. That's not what "stop" is for. For more information about it, see http://skriptlang.github.io/Skript/effects.html#EffExit
    • The way you write your "give" effects is kinda weird. Try to go with something a little bit more like this:
    Code (Text):
    1. give 8 pufferfish to player # (which is your 349:3)
    You don't need to write the item's numerical ID. Sometimes, for the sake of better code readability, it's best to simply write the item's name. If you wanna check if you're typing it right, you can always check your aliases-english.sk file in your Skript folder, which contains the list of all item patterns Skript recognizes, and that you can edit carefully if you want.
     
  4. A

    Joined:
    Jan 28, 2017
    Messages:
    2
    Likes Received:
    0
    Thank you, guys. It keeps getting this (see picture) after I've installed TuSKe and SKVault.
    Again thanks alot for your time to help :emoji_slight_smile:
     

    Attached Files:

  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,879
    Likes Received:
    127
    1) That is SkQuery GUI code, so I recommend writing Tuske GUI code rather than SkQuery, since you installed Tuske
    2) SkVault has nothing to do with balances, SkVault is for creating your own vault enabled economy system.
    For "remove x from balance of player" you need Vault and an economy plugin (such as Essentials - or SkVault if you plan on making your own economy system)
     
Loading...