Fix this sk

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

TheRobs

Member
Jan 26, 2017
16
0
1
23
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-»-a-smart-shop-script.37224/
code_language.skript:
on script load:      
    if {FShop::Messages::GlobalPrefix} is not set:
        set {FShop::Messages::GlobalPrefix} to "&6&lFunnyShop &8» "
    if {FShop::Messages::BuySignLine1} is not set:
        set {FShop::Messages::BuySignLine1} to "&4&lBuy Item"
    if {FShop::Messages::BuySignLine2} is not set:
        set {FShop::Messages::BuySignLine2} to "&0"
    if {FShop::Messages::BuySignLine3} is not set:
        set {FShop::Messages::BuySignLine3} to "&2&l&o"
    if {FShop::Messages::BuySignLine4} is not set:
        set {FShop::Messages::BuySignLine4} to "&8&nClick Here"
    if {FShop::Messages::SellSignLine1} is not set:
        set {FShop::Messages::SellSignLine1} to "&4&lSell Item"
    if {FShop::Messages::SellSignLine2} is not set:
        set {FShop::Messages::SellSignLine2} to "&0"
    if {FShop::Messages::SellSignLine3} is not set:
        set {FShop::Messages::SellSignLine3} to "&2&l&o"
    if {FShop::Messages::SellSignLine4} is not set:
        set {FShop::Messages::SellSignLine4} to "&8&nClick Here"
    if {FShop::Messages::BuyMenuTitle} is not set:
        set {FShop::Messages::BuyMenuTitle} to "&7» &8&lBuy Item"
    if {FShop::Messages::SellMenuTitle} is not set:
        set {FShop::Messages::SellMenuTitle} to "&7» &8&lSell Item"
    if {FShop::Messages::BuyMenuText} is not set:
        set {FShop::Messages::BuyMenuText} to "&c&l"
    if {FShop::Messages::SellMenuText} is not set:
        set {FShop::Messages::SellMenuText} to "&a&l"
   



on sign change:
    line 1 of event-block is "[FunnyShop]" or "[FShop]"
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    if player's gamemode is creative:

        if line 2 of event-block is "buy":
            if player has permission "fshop.buysign":
                if line 3 of event-block is not empty:
                    if line 4 of event-block is not empty:
                        set {_Line1} to "%{FShop::Messages::BuySignLine1}%"
                        set {_Line2} to "%{FShop::Messages::BuySignLine2}%"
                        set {_Line3} to "%{FShop::Messages::BuySignLine3}%"
                        set {_Line4} to "%{FShop::Messages::BuySignLine4}%"
                        set {guild::shopitem::%line 3%} to "%line 3%" parsed as item
                        set {guild::priceitem::%line 3%} to "%line 4%" parsed as number
                        set line 1 of event-block to "%{_Line1}%"
                        set line 2 of event-block to "%{_Line2}%%line 3%"
                        set line 3 of event-block to "%{_Line3}%$%line 4%"
                        set line 4 of event-block to "%{_Line4}%"
                    else:
                        message "%{_prefix}% &cYou forgot to enter the Price!"
                else:
                    message "%{_prefix}% &cYou forgot to enter the Item!"
            else:
                message "%{_prefix}% &cYou haven't got the permission for this!"

        else if line 2 of event-block is "sell":
            if player has permission "fshop.sellsign":
                if line 3 of event-block is not empty:
                    if line 4 of event-block is not empty:
                        set {_Line1} to "%{FShop::Messages::SellSignLine1}%"
                        set {_Line2} to "%{FShop::Messages::SellSignLine2}%"
                        set {_Line3} to "%{FShop::Messages::SellSignLine3}%"
                        set {_Line4} to "%{FShop::Messages::SellSignLine4}%"
                        set {guild::sellshopitem::%line 3%} to "%line 3%" parsed as item
                        set {guild::sellpriceitem::%line 3%} to "%line 4%" parsed as number
                        set line 1 of event-block to "%{_Line1}%"
                        set line 2 of event-block to "%{_Line2}%%line 3%"
                        set line 3 of event-block to "%{_Line3}%$%line 4%"
                        set line 4 of event-block to "%{_Line4}%"
                    else:
                        message "%{_prefix}% &cYou forgot to enter the Price!"
                else:
                    message "%{_prefix}% &cYou forgot to enter the Item!"
            else:
                message "%{_prefix}% &cYou haven't got the permission for this!"
        else:
            message "%{_prefix}% &cThe second line has to be Sell or Buy."
    else:
        message "%{_prefix}% &cYou need to be in Creative to do this!"
                       

right click on sign:
    set {_Line1-Buy} to "%{FShop::Messages::BuySignLine1}%"
    set {_Line4-Buy} to "%{FShop::Messages::BuySignLine4}%"
    set {_Line1-Sell} to "%{FShop::Messages::SellSignLine1}%"
    set {_Line4-Sell} to "%{FShop::Messages::SellSignLine4}%"
    line 2 of event-block is set
    line 3 of event-block is set
    if line 1 of event-block is "%{_Line1-Buy}%":
        line 4 of event-block is "%{_Line4-Buy}%"
        set {_ItemName} to "%uncoloured line 2%"
        set {_item1} to "1 %{_ItemName}%" parsed as item
        set {_item4} to "4 %{_ItemName}%" parsed as item
        set {_item8} to "8 %{_ItemName}%" parsed as item
        set {_item16} to "16 %{_ItemName}%" parsed as item
        set {_item32} to "32 %{_ItemName}%" parsed as item
        set {_item64} to "64 %{_ItemName}%" parsed as item
        set {_price1} to 1*{guild::priceitem::%{_ItemName}%}
        set {_price4} to 4*{guild::priceitem::%{_ItemName}%}
        set {_price8} to 8*{guild::priceitem::%{_ItemName}%}
        set {_price16} to 16*{guild::priceitem::%{_ItemName}%}
        set {_price32} to 32*{guild::priceitem::%{_ItemName}%}
        set {_price64} to 64*{guild::priceitem::%{_ItemName}%}
        wait 1 tick
        set {_menu} to "%{FShop::Messages::BuyMenuTitle}%"
        set {_color} to "%{FShop::Messages::BuyMenuText}%"
        open chest with 1 rows named "%{_menu}%" to player
        wait 1 tick
        set slot 1 of player's current inventory to 1 of {_item1} named "%{_color}%Buy 1x" with lore "&7&oCosts $%{_price1}%"
        set slot 2 of player's current inventory to 4 of {_item4} named "%{_color}%Buy 4x" with lore "&7&oCosts $%{_price4}%"
        set slot 3 of player's current inventory to 8 of {_item8} named "%{_color}%Buy 8x" with lore "&7&oCosts $%{_price8}%"
        set slot 4 of player's current inventory to 16 of {_item16} named "%{_color}%Buy 16x" with lore "&7&oCosts $%{_price16}%"
        set slot 5 of player's current inventory to 32 of {_item32} named "%{_color}%&e&lBuy 32x" with lore "&7&oCosts $%{_price32}%"
        set slot 6 of player's current inventory to 64 of {_item64} named "%{_color}%&e&lBuy 64x" with lore "&7&oCosts $%{_price64}%"
        set slot 8 of player's current inventory to nether star named "&c&lClose" with lore "&7&oClose this Menu"


    else if line 1 of event-block is "%{_Line1-Sell}%":
        line 4 of event-block is "%{_Line4-Sell}%"
        set {_ItemName} to "%uncoloured line 2%"
        set {_item1} to "1 %{_ItemName}%" parsed as item
        set {_item4} to "4 %{_ItemName}%" parsed as item
        set {_item8} to "8 %{_ItemName}%" parsed as item
        set {_item16} to "16 %{_ItemName}%" parsed as item
        set {_item32} to "32 %{_ItemName}%" parsed as item
        set {_item64} to "64 %{_ItemName}%" parsed as item
        set {_price1} to 1*{guild::sellpriceitem::%{_ItemName}%}
        set {_price4} to 4*{guild::sellpriceitem::%{_ItemName}%}
        set {_price8} to 8*{guild::sellpriceitem::%{_ItemName}%}
        set {_price16} to 16*{guild::sellpriceitem::%{_ItemName}%}
        set {_price32} to 32*{guild::sellpriceitem::%{_ItemName}%}
        set {_price64} to 64*{guild::sellpriceitem::%{_ItemName}%}
        wait 1 tick
        set {_menu} to "%{FShop::Messages::SellMenuTitle}%"
        set {_color} to "%{FShop::Messages::SellMenuText}%"
        open chest with 1 rows named "%{_menu}%" to player
        wait 1 tick
        set slot 1 of player's current inventory to 1 of {_item1} named "%{_color}%Sell 1x" with lore "&7&oSells for $%{_price1}%"
        set slot 2 of player's current inventory to 4 of {_item4} named "%{_color}%Sell 4x" with lore "&7&oSells for $%{_price4}%"
        set slot 3 of player's current inventory to 8 of {_item8} named "%{_color}%Sell 8x" with lore "&7&oSells for $%{_price8}%"
        set slot 4 of player's current inventory to 16 of {_item16} named "%{_color}%Sell 16x" with lore "&7&oSells for $%{_price16}%"
        set slot 5 of player's current inventory to 32 of {_item32} named "%{_color}%Sell 32x" with lore "&7&oSells for $%{_price32}%"
        set slot 6 of player's current inventory to 64 of {_item64} named "%{_color}%Sell 64x" with lore "&7&oSells for $%{_price64}%"
        set slot 8 of player's current inventory to nether star named "&c&lClose" with lore "&7&oClose this Menu"
       
       
on inventory click:
    set {_buymenu} to "%{FShop::Messages::BuyMenuTitle}%"
    set {_sellmenu} to "%{FShop::Messages::SellMenuTitle}%"
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    if inventory name of clicked inventory is "%{_sellmenu}%" or "%{_buymenu}%":
        cancel event
        if clicked slot is 1:
            set {_x} to 1
        else if clicked slot is 2:
            set {_x} to 4
        else if clicked slot is 3:
            set {_x} to 8
        else if clicked slot is 4:
            set {_x} to 16
        else if clicked slot is 5:
            set {_x} to 32
        else if clicked slot is 6:
            set {_x} to 64
        else if clicked slot is 8:
            close player's inventory
        clicked slot is 1 or 2 or 3 or 4 or 5 or 6
        set {_block} to targeted block
        set {_item} to "%uncoloured line 2 of {_block}%"
        if inventory name of clicked inventory is "%{_buymenu}%":
            set {_price} to {_x}*{guild::priceitem::%{_item}%}
            invoke "FunnyShopBuy" from player and "%{_item}%" and "%{_x}%" and "%{_price}%"
        else if inventory name of clicked inventory is "%{_sellmenu}%":
            set {_price} to {_x}*{guild::sellpriceitem::%{_item}%}
            invoke "FunnyShopSell" from player and "%{_item}%" and "%{_x}%" and "%{_price}%"
       
       
    else if inventory name of clicked inventory is " &7&l» &8&lConfiguration":
        cancel event
        if clicked slot is 10:
            if clicked item is a paper:
                name of clicked item is "&e&l&nMessages & Text Editor"
                invoke "FunnyShopMessages" from player
            else if clicked item is a book:
                name of clicked item is "&6&l&nPrefix&r "
                set {FShop::ChangingText::%uuid of player%} to "GlobalPrefix"
        else if clicked slot is 11:
            if clicked item is a book:
                name of clicked item is "&c&l&nBuy Sign&r &7- &e&l&nInfo&r "
                set {FShop::ChangingText::%uuid of player%} to "BuySignLine1"
        else if clicked slot is 12:
            if clicked item is a book:
                name of clicked item is "&c&l&nBuy Sign&r &7- &e&l&nItem Color&r "
                set {FShop::ChangingText::%uuid of player%} to "BuySignLine2"
        else if clicked slot is 13:
            if clicked item is a book:
                name of clicked item is "&c&l&nBuy Sign&r &7- &e&l&nMoney Color&r "
                set {FShop::ChangingText::%uuid of player%} to "BuySignLine3"
        else if clicked slot is 14:
            if clicked item is a book:
                name of clicked item is "&c&l&nBuy Sign&r &7- &e&l&nClick Here&r "
                set {FShop::ChangingText::%uuid of player%} to "BuySignLine4"
        else if clicked slot is 15:
            if clicked item is a book:
                name of clicked item is "&a&l&nSell Sign&r &7- &e&l&nInfo&r "
                set {FShop::ChangingText::%uuid of player%} to "SellSignLine1"
        else if clicked slot is 16:
            if clicked item is a book:
                name of clicked item is "&a&l&nSell Sign&r &7- &e&l&nItem Color&r "
                set {FShop::ChangingText::%uuid of player%} to "SellSignLine2"
        else if clicked slot is 19:
            if clicked item is a book:
                name of clicked item is "&a&l&nSell Sign&r &7- &e&l&nMoney Color&r "
                set {FShop::ChangingText::%uuid of player%} to "SellSignLine3"
        else if clicked slot is 20:
            if clicked item is a book:
                name of clicked item is "&a&l&nSell Sign&r &7- &e&l&nClick Here&r "
                set {FShop::ChangingText::%uuid of player%} to "SellSignLine4"
        else if clicked slot is 21:
            if clicked item is a book:
                name of clicked item is "&a&l&nBuy Menu&r &7- &d&l&nTitle&r "
                set {FShop::ChangingText::%uuid of player%} to "BuyMenuTitle"
        else if clicked slot is 22:
            if clicked item is a book:
                name of clicked item is "&a&l&nSell Menu&r &7- &d&l&nTitle&r "
                set {FShop::ChangingText::%uuid of player%} to "SellMenuTitle"
        else if clicked slot is 23:
            if clicked item is a book:
                name of clicked item is "&a&l&nBuy Menu&r &7- &b&l&nText Color&r "
                set {FShop::ChangingText::%uuid of player%} to "BuyMenuText"
        else if clicked slot is 24:
            if clicked item is a book:
                name of clicked item is "&a&l&nSell Menu&r &7- &b&l&nText Color&r "
                set {FShop::ChangingText::%uuid of player%} to "SellMenuText"
        else if clicked slot is 27:
            clicked item is red glass pane
            name of clicked item is " &c&l« Go Back "
            invoke "FunnyShopCMenu" from player
           
        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
        clicked item is a book
        close inventory of player
        message "&6&l%{_prefix}% &eWrite the Text you want in the Chat."
   

   
on chat:
    {FShop::ChangingText::%uuid of player%} is set
    cancel event
    set {FShop::Messages::%{FShop::ChangingText::%uuid of player%}%} to "%coloured message%"
    delete {FShop::ChangingText::%uuid of player%}
    message "%{FShop::Messages::GlobalPrefix}% &8| &aYou've succesfully changed the Text!"
    wait 10 ticks
    open chest with 4 rows named " &7&l» &8&lConfiguration" to player
    invoke "FunnyShopMessages" from player
    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
    loop {_x::*}:
        set slot loop-value of player's current inventory to black stained glass named ""

sub "FunnyShopBuy":
    set {_p} to "%parameter 1%" parsed as player
    set {_item} to "%parameter 2%" parsed as item
    set {_ItemName} to "%parameter 2%"
    set {_amount} to "%parameter 3%" parsed as integer
    set {_price} to "%parameter 4%" parsed as integer
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    if balance of {_p} >= {_price}:
        if {_p} has enough space for {_amount} of {_item}:
            remove {_price} from balance of {_p}
            give {_amount} of {_item} to {_p}
            message "%{_prefix}% &a&lYou've bought &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
        else:
            message "%{_prefix}% &cYour inventory is full!" to {_p}
    else:
        message "%{_prefix}% &cNot enough money!" to {_p}


sub "FunnyShopSell":
    set {_p} to "%parameter 1%" parsed as player
    set {_item} to "%parameter 2%" parsed as item
    set {_ItemName} to "%parameter 2%"
    set {_amount} to "%parameter 3%" parsed as integer
    set {_price} to "%parameter 4%" parsed as integer
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    if {_p}'s inventory contains {_amount} of {_item}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}
       
       
sub "FunnyShopCMenu":
    set {_p} to "%parameter 1%" parsed as player
    if inventory name of {_p}'s current inventory is " &7&l» &8&lConfiguration":
        set {_x1::*} to 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24 and 25
        loop {_x1::*}:
            set slot loop-value of {_p}'s current inventory to air
            wait 1 tick
    else:
        open chest with 4 rows named " &7&l» &8&lConfiguration" to {_p}
        wait 2 ticks
        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
        loop {_x2::*}:
            set slot loop-value of {_p}'s current inventory to black stained glass named ""
    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!|| "
    set slot 12 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    set slot 14 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    set slot 16 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    set slot 20 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    set slot 22 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
    set slot 24 of {_p}'s current inventory to barrier named "&c&l&nComing Soon" with lore " || &7... || "
   
       
sub "FunnyShopMessages":
    set {_p} to "%parameter 1%" parsed as player
    if slot 10 of {_p}'s current inventory is not air:
        set {_x::*} to 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24 and 25
        loop {_x::*}:
            set slot loop-value of {_p}'s current inventory to air
            wait 1 tick
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    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  || "
    wait 3 ticks
    set slot 27 of {_p}'s current inventory to a red glass pane named " &c&l« Go Back "
   
   
command /funnyshop [<text>]:
    permission: fshop.command
    aliases: /fshop
    trigger:
        set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
        if arg-1 is "help":
            if player has permission "fshop.help":
                message "&8&l&m--------------------------------------" to player
                message " &7»  &6/fshop help &8» &7&oThis little help menu :)" to player
                message " &7»  &6/fshop reload &8» &7&oReload the Script!" to player
                message " &7»  &6/fshop configure &8» &7&oIn-Game configuration!" to player
                message "&8&l&m--------------------------------------" to player
            else:
                message "%{_prefix}% &cYou haven't got the permission for this!"
        else if arg-1 is "configure" or "config" or "c":
            if player has permission "fshop.config":
                invoke "FunnyShopCMenu" from player
            else:
                message "%{_prefix}% &cYou haven't got the permission for this!"
       
        else if arg-1 is "reload" or "r":
            if player has permission "fshop.reload":
                load script from file "plugins/Skript/scripts/FunnyShop.sk"
                message "%{_prefix}% &aThe &fFunnyShop &aScript has been reloaded!"
            else:
                message "%{_prefix}% &cYou haven't got the permission for this!"
           
        else:
            if player has permission "fshop.help":
                make player execute command "/fshop help"
            else:
                message "%{_prefix}% &cYou haven't got the permission for this!"



#on inventory click:
#    if {guildshop::buying::%uuid of player%} is set:
#        if "%click type%" is "SHIFT_LEFT":
#            cancel event
#        if "%click type%" is "SHIFT_RIGHT":
#            cancel event

on break of sign:
    set {_Line1-Buy} to "%{FShop::Messages::BuySignLine1}%"
    set {_Line4-Buy} to "%{FShop::Messages::BuySignLine4}%"
    set {_Line1-Sell} to "%{FShop::Messages::SellSignLine1}%"
    set {_Line4-Sell} to "%{FShop::Messages::SellSignLine4}%"
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    line 2 of event-block is set
    line 3 of event-block is set
    if line 1 of event-block is "%{_Line1-Buy}%":
        line 4 of event-block is "%{_Line4-Buy}%"
        if player is not sneaking:
            cancel event
            if player has permission "fshop.destroysign":
                message "%{_prefix}% &cYou need to Sneak when you want to destroy a Shop sign!"
        else:
            if player has permission "fshop.destroysign":
                message "%{_prefix}% &a&lYou successfully removed a Shop Sign!"
            else:
                cancel event
    if line 1 of event-block is "%{_Line1-Sell}%":
        line 4 of event-block is "%{_Line4-Sell}%"
        if player is not sneaking:
            cancel event
            if player has permission "fshop.destroysign":
                message "%{_prefix}% &cYou need to Sneak when you want to destroy a Shop sign!"
        else:
            if player has permission "fshop.destroysign":
                message "%{_prefix}% &a&lYou successfully removed a Shop Sign!"
            else:
                cancel event
 
Last edited:
code_language.skript:
    if {_p}'s inventory contains {_amount} of {_item}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        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_language.skript:
sub "FunnyShopSell":
    set {_p} to "%parameter 1%" parsed as player
    set {_item} to "%parameter 2%" parsed as item
    set {_ItemName} to "%parameter 2%"
    set {_amount} to "%parameter 3%" parsed as integer
    set {_price} to "%parameter 4%" parsed as integer
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    set {_ItemSize} to amount of {_item} in {_p}'s inventory
    if {_ItemSize} >= {_amount}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}
 
Last edited:
code_language.skript:
    if {_p}'s inventory contains {_amount} of {_item}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        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_language.skript:
sub "FunnyShopSell":
    set {_p} to "%parameter 1%" parsed as player
    set {_item} to "%parameter 2%" parsed as item
    set {_ItemName} to "%parameter 2%"
    set {_amount} to "%parameter 3%" parsed as integer
    set {_price} to "%parameter 4%" parsed as integer
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    set {_ItemSize} amount of {_item} in {_p}'s inventory
    if {_ItemSize} >= {_amount}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}
Hi, thanks for helping me, he's still saying that I do not have the item to sell.
 
code_language.skript:
sub "FunnyShopSell":
    set {_p} to "%parameter 1%" parsed as player
    set {_item} to "%parameter 2%" parsed as item
    set {_ItemName} to "%parameter 2%"
    set {_amount} to "%parameter 3%" parsed as integer
    set {_price} to "%parameter 4%" parsed as integer
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    set {_ItemSize} to amount of {_item} in {_p}'s inventory
    if {_ItemSize} >= {_amount}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}

Sorry I had a typo, this should work
 
code_language.skript:
sub "FunnyShopSell":
    set {_p} to "%parameter 1%" parsed as player
    set {_item} to "%parameter 2%" parsed as item
    set {_ItemName} to "%parameter 2%"
    set {_amount} to "%parameter 3%" parsed as integer
    set {_price} to "%parameter 4%" parsed as integer
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    set {_ItemSize} to amount of {_item} in {_p}'s inventory
    if {_ItemSize} >= {_amount}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}

Sorry I had a typo, this should work
My brother, seriously I will be eternally grateful <3
[doublepost=1527031690,1527027758][/doublepost]
code_language.skript:
sub "FunnyShopSell":
    set {_p} to "%parameter 1%" parsed as player
    set {_item} to "%parameter 2%" parsed as item
    set {_ItemName} to "%parameter 2%"
    set {_amount} to "%parameter 3%" parsed as integer
    set {_price} to "%parameter 4%" parsed as integer
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    set {_ItemSize} to amount of {_item} in {_p}'s inventory
    if {_ItemSize} >= {_amount}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}

Sorry I had a typo, this should work


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
 
Last edited:
code_language.skript:
    if {_p}'s inventory contains {_amount} of {_item}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        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_language.skript:
sub "FunnyShopSell":
    set {_p} to "%parameter 1%" parsed as player
    set {_item} to "%parameter 2%" parsed as item
    set {_ItemName} to "%parameter 2%"
    set {_amount} to "%parameter 3%" parsed as integer
    set {_price} to "%parameter 4%" parsed as integer
    set {_prefix} to "%{FShop::Messages::GlobalPrefix}%"
    set {_ItemSize} to amount of {_item} in {_p}'s inventory
    if {_ItemSize} >= {_amount}:
        add {_price} to balance of {_p}
        remove {_amount} of {_item} from {_p}'s inventory
        message "%{_prefix}% &a&lYou've sold &f&l%{_amount}%x %{_ItemName}% &a&lfor &f&l$%{_price}%!" to {_p}
    else:
        message "%{_prefix}% &cYou haven't got %{_amount}%x %{_ItemName}%!" to {_p}
why are you using subroutines
 
My brother, seriously I will be eternally grateful <3
[doublepost=1527031690,1527027758][/doublepost]


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
help me