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!

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

Fix this sk

Discussion in 'Requests' started by TheRobs, May 20, 2018.

Tags:
  1. TheRobs

    TheRobs Member

    Joined:
    Jan 26, 2017
    Messages:
    14
    Likes Received:
    0
    Hello, someone could fix this sk for me, the error is as follows:
    When I sell an item, it says that I do not have this item in inventory
    Thank you!!
    Skript on spigot and informations: https://www.spigotmc.org/resources/funnyshop-%C2%BB-a-smart-shop-script.37224/
    Code (Skript):
    1. on script load:      
    2.     if {FShop::Messages::GlobalPrefix} is not set:
    3.         set {FShop::Messages::GlobalPrefix} to "&6&lFunnyShop &8» "
    4.     if {FShop::Messages::BuySignLine1} is not set:
    5.         set {FShop::Messages::BuySignLine1} to "&4&lBuy Item"
    6.     if {FShop::Messages::BuySignLine2} is not set:
    7.         set {FShop::Messages::BuySignLine2} to "&0"
    8.     if {FShop::Messages::BuySignLine3} is not set:
    9.         set {FShop::Messages::BuySignLine3} to "&2&l&o"
    10.     if {FShop::Messages::BuySignLine4} is not set:
    11.         set {FShop::Messages::BuySignLine4} to "&8&nClick Here"
    12.     if {FShop::Messages::SellSignLine1} is not set:
    13.         set {FShop::Messages::SellSignLine1} to "&4&lSell Item"
    14.     if {FShop::Messages::SellSignLine2} is not set:
    15.         set {FShop::Messages::SellSignLine2} to "&0"
    16.     if {FShop::Messages::SellSignLine3} is not set:
    17.         set {FShop::Messages::SellSignLine3} to "&2&l&o"
    18.     if {FShop::Messages::SellSignLine4} is not set:
    19.         set {FShop::Messages::SellSignLine4} to "&8&nClick Here"
    20.     if {FShop::Messages::BuyMenuTitle} is not set:
    21.         set {FShop::Messages::BuyMenuTitle} to "&7» &8&lBuy Item"
    22.     if {FShop::Messages::SellMenuTitle} is not set:
    23.         set {FShop::Messages::SellMenuTitle} to "&7» &8&lSell Item"
    24.     if {FShop::Messages::BuyMenuText} is not set:
    25.         set {FShop::Messages::BuyMenuText} to "&c&l"
    26.     if {FShop::Messages::SellMenuText} is not set:
    27.         set {FShop::Messages::SellMenuText} to "&a&l"
    28.    
    29.  
    30.  
    31.  
    32. on sign change:
    33.     line 1 of event-block is "[FunnyShop]" or "[FShop]"
    34.     set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    35.     if player's gamemode is creative:
    36.  
    37.         if line 2 of event-block is "buy":
    38.             if player has permission "fshop.buysign":
    39.                 if line 3 of event-block is not empty:
    40.                     if line 4 of event-block is not empty:
    41.                         set {_Line1} to "%{FShop::Messages::BuySignLine1}%"
    42.                         set {_Line2} to "%{FShop::Messages::BuySignLine2}%"
    43.                         set {_Line3} to "%{FShop::Messages::BuySignLine3}%"
    44.                         set {_Line4} to "%{FShop::Messages::BuySignLine4}%"
    45.                         set {guild::shopitem::%line 3%} to "%line 3%" parsed as item
    46.                         set {guild::priceitem::%line 3%} to "%line 4%" parsed as number
    47.                         set line 1 of event-block to "%{_Line1}%"
    48.                         set line 2 of event-block to "%{_Line2}%%line 3%"
    49.                         set line 3 of event-block to "%{_Line3}%$%line 4%"
    50.                         set line 4 of event-block to "%{_Line4}%"
    51.                     else:
    52.                         message "%{_prefix}% &cYou forgot to enter the Price!"
    53.                 else:
    54.                     message "%{_prefix}% &cYou forgot to enter the Item!"
    55.             else:
    56.                 message "%{_prefix}% &cYou haven't got the permission for this!"
    57.  
    58.         else if line 2 of event-block is "sell":
    59.             if player has permission "fshop.sellsign":
    60.                 if line 3 of event-block is not empty:
    61.                     if line 4 of event-block is not empty:
    62.                         set {_Line1} to "%{FShop::Messages::SellSignLine1}%"
    63.                         set {_Line2} to "%{FShop::Messages::SellSignLine2}%"
    64.                         set {_Line3} to "%{FShop::Messages::SellSignLine3}%"
    65.                         set {_Line4} to "%{FShop::Messages::SellSignLine4}%"
    66.                         set {guild::sellshopitem::%line 3%} to "%line 3%" parsed as item
    67.                         set {guild::sellpriceitem::%line 3%} to "%line 4%" parsed as number
    68.                         set line 1 of event-block to "%{_Line1}%"
    69.                         set line 2 of event-block to "%{_Line2}%%line 3%"
    70.                         set line 3 of event-block to "%{_Line3}%$%line 4%"
    71.                         set line 4 of event-block to "%{_Line4}%"
    72.                     else:
    73.                         message "%{_prefix}% &cYou forgot to enter the Price!"
    74.                 else:
    75.                     message "%{_prefix}% &cYou forgot to enter the Item!"
    76.             else:
    77.                 message "%{_prefix}% &cYou haven't got the permission for this!"
    78.         else:
    79.             message "%{_prefix}% &cThe second line has to be Sell or Buy."
    80.     else:
    81.         message "%{_prefix}% &cYou need to be in Creative to do this!"
    82.                        
    83.  
    84. right click on sign:
    85.     set {_Line1-Buy} to "%{FShop::Messages::BuySignLine1}%"
    86.     set {_Line4-Buy} to "%{FShop::Messages::BuySignLine4}%"
    87.     set {_Line1-Sell} to "%{FShop::Messages::SellSignLine1}%"
    88.     set {_Line4-Sell} to "%{FShop::Messages::SellSignLine4}%"
    89.     line 2 of event-block is set
    90.     line 3 of event-block is set
    91.     if line 1 of event-block is "%{_Line1-Buy}%":
    92.         line 4 of event-block is "%{_Line4-Buy}%"
    93.         set {_ItemName} to "%uncoloured line 2%"
    94.         set {_item1} to "1 %{_ItemName}%" parsed as item
    95.         set {_item4} to "4 %{_ItemName}%" parsed as item
    96.         set {_item8} to "8 %{_ItemName}%" parsed as item
    97.         set {_item16} to "16 %{_ItemName}%" parsed as item
    98.         set {_item32} to "32 %{_ItemName}%" parsed as item
    99.         set {_item64} to "64 %{_ItemName}%" parsed as item
    100.         set {_price1} to 1*{guild::priceitem::%{_ItemName}%}
    101.         set {_price4} to 4*{guild::priceitem::%{_ItemName}%}
    102.         set {_price8} to 8*{guild::priceitem::%{_ItemName}%}
    103.         set {_price16} to 16*{guild::priceitem::%{_ItemName}%}
    104.         set {_price32} to 32*{guild::priceitem::%{_ItemName}%}
    105.         set {_price64} to 64*{guild::priceitem::%{_ItemName}%}
    106.         wait 1 tick
    107.         set {_menu} to "%{FShop::Messages::BuyMenuTitle}%"
    108.         set {_color} to "%{FShop::Messages::BuyMenuText}%"
    109.         open chest with 1 rows named "%{_menu}%" to player
    110.         wait 1 tick
    111.         set slot 1 of player's current inventory to 1 of {_item1} named "%{_color}%Buy 1x" with lore "&7&oCosts $%{_price1}%"
    112.         set slot 2 of player's current inventory to 4 of {_item4} named "%{_color}%Buy 4x" with lore "&7&oCosts $%{_price4}%"
    113.         set slot 3 of player's current inventory to 8 of {_item8} named "%{_color}%Buy 8x" with lore "&7&oCosts $%{_price8}%"
    114.         set slot 4 of player's current inventory to 16 of {_item16} named "%{_color}%Buy 16x" with lore "&7&oCosts $%{_price16}%"
    115.         set slot 5 of player's current inventory to 32 of {_item32} named "%{_color}%&e&lBuy 32x" with lore "&7&oCosts $%{_price32}%"
    116.         set slot 6 of player's current inventory to 64 of {_item64} named "%{_color}%&e&lBuy 64x" with lore "&7&oCosts $%{_price64}%"
    117.         set slot 8 of player's current inventory to nether star named "&c&lClose" with lore "&7&oClose this Menu"
    118.  
    119.  
    120.     else if line 1 of event-block is "%{_Line1-Sell}%":
    121.         line 4 of event-block is "%{_Line4-Sell}%"
    122.         set {_ItemName} to "%uncoloured line 2%"
    123.         set {_item1} to "1 %{_ItemName}%" parsed as item
    124.         set {_item4} to "4 %{_ItemName}%" parsed as item
    125.         set {_item8} to "8 %{_ItemName}%" parsed as item
    126.         set {_item16} to "16 %{_ItemName}%" parsed as item
    127.         set {_item32} to "32 %{_ItemName}%" parsed as item
    128.         set {_item64} to "64 %{_ItemName}%" parsed as item
    129.         set {_price1} to 1*{guild::sellpriceitem::%{_ItemName}%}
    130.         set {_price4} to 4*{guild::sellpriceitem::%{_ItemName}%}
    131.         set {_price8} to 8*{guild::sellpriceitem::%{_ItemName}%}
    132.         set {_price16} to 16*{guild::sellpriceitem::%{_ItemName}%}
    133.         set {_price32} to 32*{guild::sellpriceitem::%{_ItemName}%}
    134.         set {_price64} to 64*{guild::sellpriceitem::%{_ItemName}%}
    135.         wait 1 tick
    136.         set {_menu} to "%{FShop::Messages::SellMenuTitle}%"
    137.         set {_color} to "%{FShop::Messages::SellMenuText}%"
    138.         open chest with 1 rows named "%{_menu}%" to player
    139.         wait 1 tick
    140.         set slot 1 of player's current inventory to 1 of {_item1} named "%{_color}%Sell 1x" with lore "&7&oSells for $%{_price1}%"
    141.         set slot 2 of player's current inventory to 4 of {_item4} named "%{_color}%Sell 4x" with lore "&7&oSells for $%{_price4}%"
    142.         set slot 3 of player's current inventory to 8 of {_item8} named "%{_color}%Sell 8x" with lore "&7&oSells for $%{_price8}%"
    143.         set slot 4 of player's current inventory to 16 of {_item16} named "%{_color}%Sell 16x" with lore "&7&oSells for $%{_price16}%"
    144.         set slot 5 of player's current inventory to 32 of {_item32} named "%{_color}%Sell 32x" with lore "&7&oSells for $%{_price32}%"
    145.         set slot 6 of player's current inventory to 64 of {_item64} named "%{_color}%Sell 64x" with lore "&7&oSells for $%{_price64}%"
    146.         set slot 8 of player's current inventory to nether star named "&c&lClose" with lore "&7&oClose this Menu"
    147.        
    148.        
    149. on inventory click:
    150.     set {_buymenu} to "%{FShop::Messages::BuyMenuTitle}%"
    151.     set {_sellmenu} to "%{FShop::Messages::SellMenuTitle}%"
    152.     set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    153.     if inventory name of clicked inventory is "%{_sellmenu}%" or "%{_buymenu}%":
    154.         cancel event
    155.         if clicked slot is 1:
    156.             set {_x} to 1
    157.         else if clicked slot is 2:
    158.             set {_x} to 4
    159.         else if clicked slot is 3:
    160.             set {_x} to 8
    161.         else if clicked slot is 4:
    162.             set {_x} to 16
    163.         else if clicked slot is 5:
    164.             set {_x} to 32
    165.         else if clicked slot is 6:
    166.             set {_x} to 64
    167.         else if clicked slot is 8:
    168.             close player's inventory
    169.         clicked slot is 1 or 2 or 3 or 4 or 5 or 6
    170.         set {_block} to targeted block
    171.         set {_item} to "%uncoloured line 2 of {_block}%"
    172.         if inventory name of clicked inventory is "%{_buymenu}%":
    173.             set {_price} to {_x}*{guild::priceitem::%{_item}%}
    174.             invoke "FunnyShopBuy" from player and "%{_item}%" and "%{_x}%" and "%{_price}%"
    175.         else if inventory name of clicked inventory is "%{_sellmenu}%":
    176.             set {_price} to {_x}*{guild::sellpriceitem::%{_item}%}
    177.             invoke "FunnyShopSell" from player and "%{_item}%" and "%{_x}%" and "%{_price}%"
    178.        
    179.        
    180.     else if inventory name of clicked inventory is " &7&l» &8&lConfiguration":
    181.         cancel event
    182.         if clicked slot is 10:
    183.             if clicked item is a paper:
    184.                 name of clicked item is "&e&l&nMessages & Text Editor"
    185.                 invoke "FunnyShopMessages" from player
    186.             else if clicked item is a book:
    187.                 name of clicked item is "&6&l&nPrefix&r "
    188.                 set {FShop::ChangingText::%uuid of player%} to "GlobalPrefix"
    189.         else if clicked slot is 11:
    190.             if clicked item is a book:
    191.                 name of clicked item is "&c&l&nBuy Sign&r &7- &e&l&nInfo&r "
    192.                 set {FShop::ChangingText::%uuid of player%} to "BuySignLine1"
    193.         else if clicked slot is 12:
    194.             if clicked item is a book:
    195.                 name of clicked item is "&c&l&nBuy Sign&r &7- &e&l&nItem Color&r "
    196.                 set {FShop::ChangingText::%uuid of player%} to "BuySignLine2"
    197.         else if clicked slot is 13:
    198.             if clicked item is a book:
    199.                 name of clicked item is "&c&l&nBuy Sign&r &7- &e&l&nMoney Color&r "
    200.                 set {FShop::ChangingText::%uuid of player%} to "BuySignLine3"
    201.         else if clicked slot is 14:
    202.             if clicked item is a book:
    203.                 name of clicked item is "&c&l&nBuy Sign&r &7- &e&l&nClick Here&r "
    204.                 set {FShop::ChangingText::%uuid of player%} to "BuySignLine4"
    205.         else if clicked slot is 15:
    206.             if clicked item is a book:
    207.                 name of clicked item is "&a&l&nSell Sign&r &7- &e&l&nInfo&r "
    208.                 set {FShop::ChangingText::%uuid of player%} to "SellSignLine1"
    209.         else if clicked slot is 16:
    210.             if clicked item is a book:
    211.                 name of clicked item is "&a&l&nSell Sign&r &7- &e&l&nItem Color&r "
    212.                 set {FShop::ChangingText::%uuid of player%} to "SellSignLine2"
    213.         else if clicked slot is 19:
    214.             if clicked item is a book:
    215.                 name of clicked item is "&a&l&nSell Sign&r &7- &e&l&nMoney Color&r "
    216.                 set {FShop::ChangingText::%uuid of player%} to "SellSignLine3"
    217.         else if clicked slot is 20:
    218.             if clicked item is a book:
    219.                 name of clicked item is "&a&l&nSell Sign&r &7- &e&l&nClick Here&r "
    220.                 set {FShop::ChangingText::%uuid of player%} to "SellSignLine4"
    221.         else if clicked slot is 21:
    222.             if clicked item is a book:
    223.                 name of clicked item is "&a&l&nBuy Menu&r &7- &d&l&nTitle&r "
    224.                 set {FShop::ChangingText::%uuid of player%} to "BuyMenuTitle"
    225.         else if clicked slot is 22:
    226.             if clicked item is a book:
    227.                 name of clicked item is "&a&l&nSell Menu&r &7- &d&l&nTitle&r "
    228.                 set {FShop::ChangingText::%uuid of player%} to "SellMenuTitle"
    229.         else if clicked slot is 23:
    230.             if clicked item is a book:
    231.                 name of clicked item is "&a&l&nBuy Menu&r &7- &b&l&nText Color&r "
    232.                 set {FShop::ChangingText::%uuid of player%} to "BuyMenuText"
    233.         else if clicked slot is 24:
    234.             if clicked item is a book:
    235.                 name of clicked item is "&a&l&nSell Menu&r &7- &b&l&nText Color&r "
    236.                 set {FShop::ChangingText::%uuid of player%} to "SellMenuText"
    237.         else if clicked slot is 27:
    238.             clicked item is red glass pane
    239.             name of clicked item is " &c&l« Go Back "
    240.             invoke "FunnyShopCMenu" from player
    241.            
    242.         clicked slot is 10 or 11 or 12 or 13 or 14 or 15 or 16 or 19 or 20 or 21 or 22 or 23 or 24
    243.         clicked item is a book
    244.         close inventory of player
    245.         message "&6&l%{_prefix}% &eWrite the Text you want in the Chat."
    246.    
    247.  
    248.    
    249. on chat:
    250.     {FShop::ChangingText::%uuid of player%} is set
    251.     cancel event
    252.     set {FShop::Messages::%{FShop::ChangingText::%uuid of player%}%} to "%coloured message%"
    253.     delete {FShop::ChangingText::%uuid of player%}
    254.     message "%{FShop::Messages::GlobalPrefix}% &8| &aYou've succesfully changed the Text!"
    255.     wait 10 ticks
    256.     open chest with 4 rows named " &7&l» &8&lConfiguration" to player
    257.     invoke "FunnyShopMessages" from player
    258.     set {_x::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 28, 29, 30, 31, 32, 33, 34 and 35
    259.     loop {_x::*}:
    260.         set slot loop-value of player's current inventory to black stained glass named ""
    261.  
    262. sub "FunnyShopBuy":
    263.     set {_p} to "%parameter 1%" parsed as player
    264.     set {_item} to "%parameter 2%" parsed as item
    265.     set {_ItemName} to "%parameter 2%"
    266.     set {_amount} to "%parameter 3%" parsed as integer
    267.     set {_price} to "%parameter 4%" parsed as integer
    268.     set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    269.     if balance of {_p} >= {_price}:
    270.         if {_p} has enough space for {_amount} of {_item}:
    271.             remove {_price} from balance of {_p}
    272.             give {_amount} of {_item} to {_p}
    273.             message "%{_prefix}% &a&lYou've bought &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    274.         else:
    275.             message "%{_prefix}% &cYour inventory is full!" to {_p}
    276.     else:
    277.         message "%{_prefix}% &cNot enough money!" to {_p}
    278.  
    279.  
    280. sub "FunnyShopSell":
    281.     set {_p} to "%parameter 1%" parsed as player
    282.     set {_item} to "%parameter 2%" parsed as item
    283.     set {_ItemName} to "%parameter 2%"
    284.     set {_amount} to "%parameter 3%" parsed as integer
    285.     set {_price} to "%parameter 4%" parsed as integer
    286.     set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    287.     if {_p}'s inventory contains {_amount} of {_item}:
    288.         add {_price} to balance of {_p}
    289.         remove {_amount} of {_item} from {_p}'s inventory
    290.         message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    291.     else:
    292.         message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}
    293.        
    294.        
    295. sub "FunnyShopCMenu":
    296.     set {_p} to "%parameter 1%" parsed as player
    297.     if inventory name of {_p}'s current inventory is " &7&l» &8&lConfiguration":
    298.         set {_x1::*} to 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24 and 25
    299.         loop {_x1::*}:
    300.             set slot loop-value of {_p}'s current inventory to air
    301.             wait 1 tick
    302.     else:
    303.         open chest with 4 rows named " &7&l» &8&lConfiguration" to {_p}
    304.         wait 2 ticks
    305.         set {_x2::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 28, 29, 30, 31, 32, 33, 34 and 35
    306.         loop {_x2::*}:
    307.             set slot loop-value of {_p}'s current inventory to black stained glass named ""
    308.     set slot 10 of {_p}'s current inventory to paper named "&e&l&nMessages & Text Editor" with lore " ||&7Click here to change the messages||&7of this small FunnyShop Script!|| "
    309.     set slot 12 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    310.     set slot 14 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    311.     set slot 16 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    312.     set slot 20 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    313.     set slot 22 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    314.     set slot 24 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    315.    
    316.        
    317. sub "FunnyShopMessages":
    318.     set {_p} to "%parameter 1%" parsed as player
    319.     if slot 10 of {_p}'s current inventory is not air:
    320.         set {_x::*} to 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24 and 25
    321.         loop {_x::*}:
    322.             set slot loop-value of {_p}'s current inventory to air
    323.             wait 1 tick
    324.     set slot 10 of {_p}'s current inventory to a book named "&6&l&nPrefix&r " with lore " || &7Current Prefix: || &8» &7'&f%{FShop::Messages::GlobalPrefix}%&7'&r  || "
    325.     set slot 11 of {_p}'s current inventory to a book named "&c&l&nBuy Sign&r &7- &e&l&nInfo&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::BuySignLine1}%&7'&r  || "
    326.     set slot 12 of {_p}'s current inventory to a book named "&c&l&nBuy Sign&r &7- &e&l&nItem Color&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::BuySignLine2}%Example&7'&r  || "
    327.     set slot 13 of {_p}'s current inventory to a book named "&c&l&nBuy Sign&r &7- &e&l&nMoney Color&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::BuySignLine3}%Example&7'&r  || "
    328.     set slot 14 of {_p}'s current inventory to a book named "&c&l&nBuy Sign&r &7- &e&l&nClick Here&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::BuySignLine4}%&7'&r  || "
    329.     set slot 15 of {_p}'s current inventory to a book named "&a&l&nSell Sign&r &7- &e&l&nInfo&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::SellSignLine1}%&7'&r  || "
    330.     set slot 16 of {_p}'s current inventory to a book named "&a&l&nSell Sign&r &7- &e&l&nItem Color&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::SellSignLine2}%Example&7'&r  || "
    331.     set slot 19 of {_p}'s current inventory to a book named "&a&l&nSell Sign&r &7- &e&l&nMoney Color&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::SellSignLine3}%Example&7'&r  || "
    332.     set slot 20 of {_p}'s current inventory to a book named "&a&l&nSell Sign&r &7- &e&l&nClick Here&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::SellSignLine4}%&7'&r  || "
    333.     set slot 21 of {_p}'s current inventory to a book named "&a&l&nBuy Menu&r &7- &d&l&nTitle&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::BuyMenuTitle}%&7'&r  || "
    334.     set slot 22 of {_p}'s current inventory to a book named "&a&l&nSell Menu&r &7- &d&l&nTitle&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::SellMenuTitle}%&7'&r  || "
    335.     set slot 23 of {_p}'s current inventory to a book named "&a&l&nBuy Menu&r &7- &b&l&nText Color&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::BuyMenuText}%Example&7'&r  || "
    336.     set slot 24 of {_p}'s current inventory to a book named "&a&l&nSell Menu&r &7- &b&l&nText Color&r " with lore " || &7Currently: || &8» &7'&f%{FShop::Messages::SellMenuText}%Example&7'&r  || "
    337.     wait 3 ticks
    338.     set slot 27 of {_p}'s current inventory to a red glass pane named " &c&l« Go Back "
    339.    
    340.    
    341. command /funnyshop [<text>]:
    342.     permission: fshop.command
    343.     aliases: /fshop
    344.     trigger:
    345.         set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    346.         if arg-1 is "help":
    347.             if player has permission "fshop.help":
    348.                 message "&8&l&m--------------------------------------" to player
    349.                 message " &7»  &6/fshop help &8» &7&oThis little help menu :)" to player
    350.                 message " &7»  &6/fshop reload &8» &7&oReload the Script!" to player
    351.                 message " &7»  &6/fshop configure &8» &7&oIn-Game configuration!" to player
    352.                 message "&8&l&m--------------------------------------" to player
    353.             else:
    354.                 message "%{_prefix}% &cYou haven't got the permission for this!"
    355.         else if arg-1 is "configure" or "config" or "c":
    356.             if player has permission "fshop.config":
    357.                 invoke "FunnyShopCMenu" from player
    358.             else:
    359.                 message "%{_prefix}% &cYou haven't got the permission for this!"
    360.        
    361.         else if arg-1 is "reload" or "r":
    362.             if player has permission "fshop.reload":
    363.                 load script from file "plugins/Skript/scripts/FunnyShop.sk"
    364.                 message "%{_prefix}% &aThe &fFunnyShop &aScript has been reloaded!"
    365.             else:
    366.                 message "%{_prefix}% &cYou haven't got the permission for this!"
    367.            
    368.         else:
    369.             if player has permission "fshop.help":
    370.                 make player execute command "/fshop help"
    371.             else:
    372.                 message "%{_prefix}% &cYou haven't got the permission for this!"
    373.  
    374.  
    375.  
    376. #on inventory click:
    377. #    if {guildshop::buying::%uuid of player%} is set:
    378. #        if "%click type%" is "SHIFT_LEFT":
    379. #            cancel event
    380. #        if "%click type%" is "SHIFT_RIGHT":
    381. #            cancel event
    382.  
    383. on break of sign:
    384.     set {_Line1-Buy} to "%{FShop::Messages::BuySignLine1}%"
    385.     set {_Line4-Buy} to "%{FShop::Messages::BuySignLine4}%"
    386.     set {_Line1-Sell} to "%{FShop::Messages::SellSignLine1}%"
    387.     set {_Line4-Sell} to "%{FShop::Messages::SellSignLine4}%"
    388.     set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    389.     line 2 of event-block is set
    390.     line 3 of event-block is set
    391.     if line 1 of event-block is "%{_Line1-Buy}%":
    392.         line 4 of event-block is "%{_Line4-Buy}%"
    393.         if player is not sneaking:
    394.             cancel event
    395.             if player has permission "fshop.destroysign":
    396.                 message "%{_prefix}% &cYou need to Sneak when you want to destroy a Shop sign!"
    397.         else:
    398.             if player has permission "fshop.destroysign":
    399.                 message "%{_prefix}% &a&lYou successfully removed a Shop Sign!"
    400.             else:
    401.                 cancel event
    402.     if line 1 of event-block is "%{_Line1-Sell}%":
    403.         line 4 of event-block is "%{_Line4-Sell}%"
    404.         if player is not sneaking:
    405.             cancel event
    406.             if player has permission "fshop.destroysign":
    407.                 message "%{_prefix}% &cYou need to Sneak when you want to destroy a Shop sign!"
    408.         else:
    409.             if player has permission "fshop.destroysign":
    410.                 message "%{_prefix}% &a&lYou successfully removed a Shop Sign!"
    411.             else:
    412.                 cancel event
    413.  
    414.  
    415.                            
     
    #1 TheRobs, May 20, 2018
    Last edited: May 22, 2018
  2. JustADev

    JustADev Well-Known Member

    Joined:
    Apr 8, 2017
    Messages:
    380
    Likes Received:
    9
    Code (Skript):
    1.     if {_p}'s inventory contains {_amount} of {_item}:
    2.         add {_price} to balance of {_p}
    3.         remove {_amount} of {_item} from {_p}'s inventory
    4.         message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    5.     else:
    6.         message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}
    The way you set this up, it will only let you sell it if you have that exact amount.
    For example, if it was 32 items, and I had 33 items, it would say I cant sell it...

    To fix it, use:
    Code (Skript):
    1. sub "FunnyShopSell":
    2.     set {_p} to "%parameter 1%" parsed as player
    3.     set {_item} to "%parameter 2%" parsed as item
    4.     set {_ItemName} to "%parameter 2%"
    5.     set {_amount} to "%parameter 3%" parsed as integer
    6.     set {_price} to "%parameter 4%" parsed as integer
    7.     set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    8.     set {_ItemSize} to amount of {_item} in {_p}'s inventory
    9.     if {_ItemSize} >= {_amount}:
    10.         add {_price} to balance of {_p}
    11.         remove {_amount} of {_item} from {_p}'s inventory
    12.         message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    13.     else:
    14.         message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}
    15.    
    16.        
     
    #2 JustADev, May 21, 2018
    Last edited: May 22, 2018
  3. TheRobs

    TheRobs Member

    Joined:
    Jan 26, 2017
    Messages:
    14
    Likes Received:
    0
    Hi, thanks for helping me, he's still saying that I do not have the item to sell.
     
  4. JustADev

    JustADev Well-Known Member

    Joined:
    Apr 8, 2017
    Messages:
    380
    Likes Received:
    9
    Code (Skript):
    1. sub "FunnyShopSell":
    2.     set {_p} to "%parameter 1%" parsed as player
    3.     set {_item} to "%parameter 2%" parsed as item
    4.     set {_ItemName} to "%parameter 2%"
    5.     set {_amount} to "%parameter 3%" parsed as integer
    6.     set {_price} to "%parameter 4%" parsed as integer
    7.     set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    8.     set {_ItemSize} to amount of {_item} in {_p}'s inventory
    9.     if {_ItemSize} >= {_amount}:
    10.         add {_price} to balance of {_p}
    11.         remove {_amount} of {_item} from {_p}'s inventory
    12.         message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    13.     else:
    14.         message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}
    15.    
    16.        

    Sorry I had a typo, this should work
     
  5. TheRobs

    TheRobs Member

    Joined:
    Jan 26, 2017
    Messages:
    14
    Likes Received:
    0
    My brother, seriously I will be eternally grateful <3
    --- Double Post Merged, May 23, 2018, Original Post Date: May 22, 2018 ---

    One more bug, sometimes if I close one store and open another, a bug occurs, it changes the inventory item, but sells or buys the item from the previous store
     
    #5 TheRobs, May 23, 2018
    Last edited: May 23, 2018
  6. Pikachu

    Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    why are you using subroutines
     
  7. Rezz

    Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    80
    Likes Received:
    37
    Medals:
    why not
     
  8. TheRobs

    TheRobs Member

    Joined:
    Jan 26, 2017
    Messages:
    14
    Likes Received:
    0
    help me
     

Share This Page

Loading...