Help with a "shop" script

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

Status
Not open for further replies.
Jan 28, 2017
2
0
0
24
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.
2049c3d4f91c935e958032f85a4474d5

There's only this in console:
09.07 23:10:07 [Server] INFO UserName issued server command: /sk reload fiskemain1

Code:
command /fisker:
    trigger:
        wait 1 tick
        open chest with 1 rows named "&9&lFisker" to player
        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"]
        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"]   
        stop
        
command /købfiskafmanden1232:
    trigger:
        wait 1 tick
        open chest with 1 rows named "&9&lVælg fisk" to player
        format slot 3 of player with 1 of cooked fish named "&3Stegt fisk" to close then run [execute player command "/købstegtfiskafmanden1232"]
        format slot 5 of player with 1 of cooked salmon named "&3Stegt laks" to close then run [execute player command "/købstegtlaksfiskemanden123213"]
        format slot 7 of player with 1 of pufferfish named "&3Kuglefisk" to close then run [execute player command "/købkuglefiskfiskemanden123213"]       
        stop
    
command /købstegtfiskafmanden1232:
    trigger:
        open chest with 1 rows named "&9&lKøb stegt fisk" to player
        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"]
        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"]
        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"]
        stop
        
command /købstegtlaksfiskemanden123213:
    trigger:
        open chest with 1 rows named "&9&lKøb stegt laks" to player
        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"]
        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"]
        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"]
        stop   
        
command /købkuglefiskfiskemanden123213:
    trigger:
        open chest with 1 rows named "&9&lKøb kuglefisk" to player
        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"]
        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"]
        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"]       
        stop
        
command /køb1stegtfiskafmanden1232:
    trigger:
      if player's balance >= 50:
        give potato to player
        subtract 50 from player's balance
            message "&9Fisker &e> &4&lKøbte 1 stegt fisk."
                  else:
        message "&7Du har ikke nok penge."
    
command /køb8stegtfiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 400:
            subtract 400 from player's balance
            give player 8 of 350
            message "&9Fisker &e> &4&lKøbte 8 stegte fisk."
            stop       

command /køb16stegtfiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 800:
            subtract 800 from player's balance
            give player 16 of 350
            message "&9Fisker &e> &4&lKøbte 16 stegte fisk."
            stop   
        
command /køb1stegtlaksafmanden1232:
    trigger:
        if player's balance is greater than or equal to 60:
            subtract 60 from player's balance
            give player 1 of 350:1
            message "&9Fisker &e> &4&lKøbte 1 stegt laks."
            stop
    
command /køb8stegtlaksafmanden1232:
    trigger:
        if player's balance is greater than or equal to 480:
            subtract 480 from player's balance
            give player 8 of 350:1
            message "&9Fisker &e> &4&lKøbte 8 stegte laks."
            stop
            
command /køb16stegtlaksafmanden1232:
    trigger:
        if player's balance is greater than or equal to 960:
            subtract 960 from player's balance
            give player 16 of 350:1
            message "&9Fisker &e> &4&lKøbte 16 stegte laks."
            stop
    
command /køb1kuglefiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 35:
            subtract 35 from player's balance
            give player 1 of 349:3
            message "&9Fisker &e> &4&lKøbte 1 kuglefisk."
            stop
    
command /køb8kuglefiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 280:
            subtract 280 from player's balance
            give player 8 of 349:3
            message "&9Fisker &e> &4&lKøbte 8 kuglefiske."
            stop
    
command /køb8kuglefiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 560:
            subtract 560 from player's balance
            give player 16 of 349:3
            message "&9Fisker &e> &4&lKøbte 16 kuglefiske."
[doublepost=1562706748,1562706702][/doublepost]I just saw that my picture wouldn't work, so here is the picture.
 

Attachments

  • skun.png
    skun.png
    287.1 KB · Views: 151
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.
2049c3d4f91c935e958032f85a4474d5

There's only this in console:
09.07 23:10:07 [Server] INFO UserName issued server command: /sk reload fiskemain1

Code:
command /fisker:
    trigger:
        wait 1 tick
        open chest with 1 rows named "&9&lFisker" to player
        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"]
        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"]  
        stop
       
command /købfiskafmanden1232:
    trigger:
        wait 1 tick
        open chest with 1 rows named "&9&lVælg fisk" to player
        format slot 3 of player with 1 of cooked fish named "&3Stegt fisk" to close then run [execute player command "/købstegtfiskafmanden1232"]
        format slot 5 of player with 1 of cooked salmon named "&3Stegt laks" to close then run [execute player command "/købstegtlaksfiskemanden123213"]
        format slot 7 of player with 1 of pufferfish named "&3Kuglefisk" to close then run [execute player command "/købkuglefiskfiskemanden123213"]      
        stop
   
command /købstegtfiskafmanden1232:
    trigger:
        open chest with 1 rows named "&9&lKøb stegt fisk" to player
        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"]
        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"]
        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"]
        stop
       
command /købstegtlaksfiskemanden123213:
    trigger:
        open chest with 1 rows named "&9&lKøb stegt laks" to player
        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"]
        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"]
        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"]
        stop  
       
command /købkuglefiskfiskemanden123213:
    trigger:
        open chest with 1 rows named "&9&lKøb kuglefisk" to player
        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"]
        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"]
        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"]      
        stop
       
command /køb1stegtfiskafmanden1232:
    trigger:
      if player's balance >= 50:
        give potato to player
        subtract 50 from player's balance
            message "&9Fisker &e> &4&lKøbte 1 stegt fisk."
                  else:
        message "&7Du har ikke nok penge."
   
command /køb8stegtfiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 400:
            subtract 400 from player's balance
            give player 8 of 350
            message "&9Fisker &e> &4&lKøbte 8 stegte fisk."
            stop      

command /køb16stegtfiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 800:
            subtract 800 from player's balance
            give player 16 of 350
            message "&9Fisker &e> &4&lKøbte 16 stegte fisk."
            stop  
       
command /køb1stegtlaksafmanden1232:
    trigger:
        if player's balance is greater than or equal to 60:
            subtract 60 from player's balance
            give player 1 of 350:1
            message "&9Fisker &e> &4&lKøbte 1 stegt laks."
            stop
   
command /køb8stegtlaksafmanden1232:
    trigger:
        if player's balance is greater than or equal to 480:
            subtract 480 from player's balance
            give player 8 of 350:1
            message "&9Fisker &e> &4&lKøbte 8 stegte laks."
            stop
           
command /køb16stegtlaksafmanden1232:
    trigger:
        if player's balance is greater than or equal to 960:
            subtract 960 from player's balance
            give player 16 of 350:1
            message "&9Fisker &e> &4&lKøbte 16 stegte laks."
            stop
   
command /køb1kuglefiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 35:
            subtract 35 from player's balance
            give player 1 of 349:3
            message "&9Fisker &e> &4&lKøbte 1 kuglefisk."
            stop
   
command /køb8kuglefiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 280:
            subtract 280 from player's balance
            give player 8 of 349:3
            message "&9Fisker &e> &4&lKøbte 8 kuglefiske."
            stop
   
command /køb8kuglefiskafmanden1232:
    trigger:
        if player's balance is greater than or equal to 560:
            subtract 560 from player's balance
            give player 16 of 349:3
            message "&9Fisker &e> &4&lKøbte 16 kuglefiske."
[doublepost=1562706748,1562706702][/doublepost]I just saw that my picture wouldn't work, so here is the picture.
Use TuSKe (GUI manager) or vanilla Skript for GUI's
 
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:
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.
 
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:
 

Attachments

  • hjælp.png
    hjælp.png
    133.4 KB · Views: 142
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:
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)
 
Status
Not open for further replies.