Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-----------------------------------------------------------------------------------------------#
- # RIGHT CLICKING TO OPEN SHOP/STORE MENU » HOLOGRAPHIC DISPLAYS #
- #-----------------------------------------------------------------------------------------------#
- on left click:
- #message "TARGETED = (%targeted entity%)" to player
- "%targeted entity of player%" is "armor stand"
- distance between targeted entity of player and player < 4
- set {_loc} to location of targeted entity of player
- add 2.45 to y-coordinate of {_loc}
- #set y-coordinate of {_loc} to y-coordinate of {_loc} rounded to the nearest 1 decimal place
- set {_types::*} to "Shop" and "Store"
- loop {_types::*}:
- loop {FSShop::ListOf%loop-value%s::*}:
- "%{_loc}%" is "%{FSShop::%loop-value-1%Settings::Location::%loop-value-2%}%"
- set {_id} to "%loop-value-2%"
- set {_type} to "%loop-value-1%"
- stop loop
- {_id} is set
- stop loop
- {_id} is set
- cancel event
- if {_type} is set:
- if {FSShop::%{_type}%Settings::ShopOpened::%{_id}%} is "OPEN":
- set {FSShop::PlayerStats::MenuType::%uuid of player%} to "Buy"
- set {_p} to player
- set {_page} to 1
- if {_type} is "Shop":
- if player has permission "fshop.*" or "fshop.use.all" or "fshop.use.shops.all" or "fshop.use.shops.%{_id}%":
- skellett open "CHEST" with 3 rows named "&8&lID: %{_id}% » Shop Menu" to player
- wait 2 ticks
- FunnyServerShop_RefreshShop({_p} , {_id})
- else:
- message "%{FSShop::ChatPrefix}%&cYou haven't got permission to open this Shop!" to player
- else if {_type} is "Store":
- if player has permission "fshop.*" or "fshop.use.all" or "fshop.use.stores.all" or "fshop.use.stores.%{_id}%":
- skellett open "CHEST" with 6 rows named "&8&lID: %{_id}% » Store Menu" to player
- wait 2 ticks
- FunnyServerShop_RefreshStore({_p} , {_id}, {_page})
- else:
- message "%{FSShop::ChatPrefix}%&cYou haven't got permission to open this Store!" to player
- else:
- message "%{FSShop::ChatPrefix}%&cERROR! &7Couldn't detect type." to player
- else:
- message "%{FSShop::ChatPrefix}%&cSorry, this Shop is currently unavailable!" to player
- else:
- message "%{FSShop::ChatPrefix}%&cERROR! &7Couldn't find type." to player
- #-------------------------------------------------------------------------------------#
- # RIGHT CLICKING TO OPEN SHOP/STORE MENU » CITIZENS (NPC'S) #
- #-------------------------------------------------------------------------------------#
- on right click on entity:
- loop {FSShop::ListOfShops::*}:
- "%location of targeted entity%" is "%{FSShop::ShopSettings::Location::%loop-value%}%"
- set {_id} to "%loop-value%"
- if {_id} is set:
- cancel event
- if {FSShop::ShopSettings::ShopOpened::%{_id}%} is "OPEN":
- if event-player has permission "fshop.*" or "fshop.use.all" or "fshop.use.shops.all" or "fshop.use.shops.%{_id}%":
- skellett open "CHEST" with 3 rows named "&8&lID: %{_id}% » Shop Menu" to event-player
- set {FSShop::PlayerStats::MenuType::%uuid of event-player%} to "Buy"
- wait 2 ticks
- set {_p} to event-player
- FunnyServerShop_RefreshShop({_p} , {_id})
- else:
- message "%{FSShop::ChatPrefix}%&cYou haven't got permission to open this Shop!" to event-player
- else:
- message "%{FSShop::ChatPrefix}%&cSorry, this Shop is currently unavailable!" to event-player
- else:
- loop {FSShop::ListOfStores::*}:
- "%location of targeted entity%" is "%{FSShop::StoreSettings::Location::%loop-value%}%"
- set {_id2} to "%loop-value%"
- if {_id2} is set:
- cancel event
- if {FSShop::StoreSettings::ShopOpened::%{_id2}%} is "OPEN":
- if event-player has permission "fshop.*" or "fshop.use.all" or "fshop.use.stores.all" or "fshop.use.stores.%{_id2}%":
- skellett open "CHEST" with 6 rows named "&8&lID: %{_id2}% » Store Menu" to event-player
- wait 2 ticks
- set {_p} to event-player
- set {_page} to 1
- FunnyServerShop_RefreshStore({_p}, {_id2}, {_page})
- else:
- message "%{FSShop::ChatPrefix}%&cYou haven't got permission to open this Store!" to event-player
- else:
- message "%{FSShop::ChatPrefix}%&cSorry, this Store is currently unavailable!" to event-player
- #--------------------------------------------------------------------------------#
- # RIGHT CLICKING TO OPEN SHOP/STORE MENU » SIGN SYSTEM #
- #--------------------------------------------------------------------------------#
- on right click on sign:
- if line 1 of targeted block contains "&4&l&nShop ":
- set {_type} to "Shop"
- else if line 2 of targeted block contains "&4&l&nStore ":
- set {_type} to "Store"
- {_type} is set
- if player's gamemode is creative:
- message "%{FSShop::ChatPrefix}%&cYou only can open Shops when in Creative!" to player
- stop
- #message "TYPE = (%{_type}%)" to player
- loop {FSShop::ListOf%{_type}%s::*}:
- #message "LOC = (%location of event-block%) en (%{FSShop::%{_type}%Settings::Location::%loop-value%}%)"
- location of event-block is {FSShop::%{_type}%Settings::Location::%loop-value%}
- set {_found} to "%loop-value%"
- #message "FOUND = (%{_found}%)" to player
- {_found} is set
- if player has permission "fshop.*" or "fshop.use.all" or "fshop.use.%{_type}%s.all" or "fshop.use.%{_type}%s.%{_found}%":
- #skellett open "CHEST" with 3 rows named "&8&lID: %{_found}% » Shop Menu" to player
- wait 2 ticks
- set {_p} to player
- if {_type} is "Shop":
- set {FSShop::PlayerStats::MenuType::%uuid of player%} to "Buy"
- skellett open "CHEST" with 3 rows named "&8&lID: %{_found}% » Shop Menu" to player
- FunnyServerShop_RefreshShop({_p} , {_found})
- else:
- set {_page} to 1
- skellett open "CHEST" with 6 rows named "&8&lID: %{_found}% » Store Menu" to player
- FunnyServerShop_RefreshStore({_p} , {_found}, {_page})
- else:
- message "%{FSShop::ChatPrefix}%&cYou haven't got the permission to open this Shop!" to player
- #-------------------------------------------------#
- # INVENTORY CLICK EVENT, SHOP MENU #
- #-------------------------------------------------#
- on inventory click:
- clicked item is not air
- clicked inventory is not player's inventory
- if uncoloured inventory name of player's current inventory contains " » Shop Menu":
- cancel event
- set {_id1} to uncoloured inventory name of player's current inventory
- set {_id2} to first (length of {_id1} - 12) characters of {_id1}
- set {_id} to the last (length of {_id2} - 4) characters of {_id2}
- set {_type1} to uncoloured name of slot 16 of player's current inventory
- if the first 3 characters of {_type1} is "Buy":
- set {_type} to "Buy"
- else if the first 4 characters of {_type1} is "Sell":
- set {_type} to "Sell"
- if clicked slot is 10 or 11 or 12 or 13 or 14:
- set {_am1} to uncoloured name of clicked item
- if {_type} is "Buy":
- set {_am2} to the last (length of {_am1} - 4) characters of {_am1}
- else if {_type} is "Sell":
- set {_am2} to the last (length of {_am1} - 5) characters of {_am1}
- else:
- message "%{FSShop::ChatPrefix}%&cError! No Type could be found!"
- set {_amount} to the first (length of {_am2} - 6) characters of {_am2} parsed as integer
- set {_price1} to uncoloured line 3 of targeted block
- set {_price2} to {FSShop::ShopSettings::%{_type}%ingPrice::%{_id}%}
- set {_price} to "%{_price2}%" parsed as number
- if uncoloured lore of clicked item contains "Balance":
- set {_method} to "Balance"
- if uncoloured lore of clicked item contains "Points":
- set {_method} to "Points"
- if {_method} is set:
- if clicked slot is 14:
- message "%{FSShop::ChatPrefix}%&3Type the amount you want to %{_type}%." to player
- set {FSShop::PlayerStats::TypingCustomType::%uuid of player%} to "%{_type}%"
- set {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%} to {_price}
- set {FSShop::PlayerStats::TypingCustomItem::%uuid of player%} to {FSShop::ShopSettings::SoldItem::%{_id}%}
- set {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%} to "%{_method}%"
- wait 2 ticks
- close player's inventory
- else:
- set {_p} to player
- set {_item} to {FSShop::ShopSettings::SoldItem::%{_id}%}
- FunnyServerShop_SellBuyItem({_p} , {_type} , {_price} , {_amount} , {_item} , {_method})
- else:
- message "%{FSShop::ChatPrefix}%&cCouldn't find the Method you specified! Try to reopen the menu!"
- else if clicked slot is 16:
- if {_type} is "Buy":
- set {FSShop::PlayerStats::MenuType::%uuid of player%} to "Sell"
- else if {_type} is "Sell":
- set {FSShop::PlayerStats::MenuType::%uuid of player%} to "Buy"
- else:
- message "%{FSShop::ChatPrefix}%&cError! Couldn't find Type to switch!"
- set {_p} to player
- FunnyServerShop_RefreshShop({_p} , {_id})
- #-----------------------------------------------------------------#
- # INVENTORY CLICK EVENT, STORE MENU MECHANICS #
- #-----------------------------------------------------------------#
- else if uncoloured inventory name of player's current inventory contains " » Store Menu":
- cancel event
- clicked item is not air
- set {_id1} to uncoloured inventory name of player's current inventory
- set {_id2} to first (length of {_id1} - 13) characters of {_id1}
- set {_id} to the last (length of {_id2} - 4) characters of {_id2}
- set {_z::*} to 47, 48, 49, 50 and 51
- set {_amounts::*} to 1, 8, 32 and 64
- if clicked slot is 53:
- message "%{FSShop::ChatPrefix}%&cThis Feature is coming in an update soon!"
- else if name of clicked item is set:
- if clicked slot is not 47 or 48 or 49 or 50 or 51:
- if name of clicked item contains "&7&l&nGo to Page ":
- set {_page1} to the last (length of uncoloured name of clicked item - 11) characters of uncoloured name of clicked item
- set {_page} to "%{_page1}%" parsed as integer
- set {_p} to player
- skellett open "CHEST" with 6 rows named "&8&lID: %{_id}% » Store Menu" to event-player
- wait 2 ticks
- FunnyServerShop_RefreshStore({_p}, {_id}, {_page})
- else if name of clicked item is not "&c&l&nNo Items found!" or "&a&l&nMore Information":
- if "%click type%" is "left mouse button":
- set {_type} to "Buy"
- set {_color} to "&a&l"
- else if "%click type%" is "right mouse button":
- set {_type} to "Sell"
- set {_color} to "&c&l"
- {_type} is set
- if {FSShop::PlayerStats::StoreItemSelected::%uuid of player%} is clicked item:
- delete {FSShop::PlayerStats::StoreItemSelected::%uuid of player%}
- loop {_z::*}:
- set slot loop-value of player's current inventory to black glass pane named "&7&l&nNo Item Selected." with lore " || &fSelect an Item by clicking on || &fan slot as shown above. || "
- else:
- set {_item1} to 1 of clicked item
- set name of {_item1} to ""
- set {_item} to "%{_item1}%" parsed as text
- {FSShop::StoreSettings::%{_item}%::%{_type}%able::%{_id}%} is not "Disabled"
- set {FSShop::PlayerStats::StoreItemSelected::%uuid of player%} to clicked item
- set {_price} to {FSShop::StoreSettings::%{_item}%::%{_type}%ingPrice::%{_id}%}
- set {_slot} to 47
- loop {_amounts::*}:
- set {_totalPrice} to (loop-value * {_price})
- set slot {_slot} of player's current inventory to loop-value of {FSShop::PlayerStats::StoreItemSelected::%uuid of player%} named "%{_color}%&n%{_type}% %loop-value%x %{_item}%" with lore " || &eTotal Price: &f$%{_totalPrice}% || "
- add 1 to {_slot}
- set slot {_slot} of player's current inventory to emerald named "&6&l&n%{_type}% Custom Amount" with lore " || &bMethod: &fBalance || ||&9Click to %{_type}%!"
- else if clicked slot is 47 or 48 or 49 or 50 or 51:
- name of clicked slot is set
- name of clicked slot is not "&7&l&nNo Item Selected."
- set {_type} to the first 4 characters of uncoloured name of clicked item
- replace all " " with "" in {_type}
- set {_item} to 1 of {FSShop::PlayerStats::StoreItemSelected::%uuid of player%}
- set name of {_item} to ""
- set {_item1} to "%{_item}%" parsed as text
- set {_price} to {FSShop::StoreSettings::%{_item1}%::%{_type}%ingPrice::%{_id}%}
- set {_method} to "Balance"
- if clicked slot is 51:
- name of clicked item contains " Custom Amount"
- message "%{FSShop::ChatPrefix}%&3Type the amount you want to %{_type}%." to player
- set {FSShop::PlayerStats::TypingCustomType::%uuid of player%} to "%{_type}%"
- set {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%} to {_price}
- set {FSShop::PlayerStats::TypingCustomItem::%uuid of player%} to {_item}
- set {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%} to "%{_method}%"
- wait 2 ticks
- close player's inventory
- else:
- set {_p} to player
- set {_amount} to "%size of item clicked item%" parsed as integer
- FunnyServerShop_SellBuyItem({_p} , {_type} , {_price} , {_amount} , {_item} , {_method})
- #-------------------------#
- # END OF TRIGGERS #
- #-------------------------#
- #----------------------------------------------------------------#
- # THE FUNCTION OF OPENING THE MENU OF A SHOP #
- #----------------------------------------------------------------#
- function FunnyServerShop_RefreshShop(p: player , id: text):
- set {_uuid} to uuid of {_p}
- set {_item} to {FSShop::ShopSettings::SoldItem::%{_id}%}
- set {_pl} to 0
- if {FSShop::PlayerStats::MenuType::%{_uuid}%} is not set:
- set {FSShop::PlayerStats::MenuType::%{_uuid}%} to "Buy"
- #set {_price} to {FSShop::ShopSettings::%{FSShop::PlayerStats::MenuType::%{_uuid}%}%ingPrice::%{_id}%}
- set {_verVault} to version of "Vault"
- set {_verPP} to version of "PlayerPoints"
- if {_verVault} is not "<none>":
- set {_vaultPL} to true
- set {_type} to "Balance"
- add 1 to {_pl}
- else if {_verPP} is not "<none>":
- set {_pointsPL} to true
- set {_type} to "PlayerPoints"
- add 1 to {_pl}
- set {_menu} to {FSShop::PlayerStats::MenuType::%{_uuid}%}
- set {_price} to {FSShop::ShopSettings::%{_menu}%ingPrice::%{_id}%}
- set {_x} to 10
- set {_y::*} to 1, 8, 32 and 64
- loop {_y::*}:
- set {_loopPrice} to (loop-value * {_price})
- #if {_type} is "Vault":
- if {_menu} is "Buy":
- set slot {_x} of {_p}'s current inventory to loop-value of {_item} named "&a&l&n%{_menu}% %loop-value% times" with lore " || &eTotal Price: &f$%{_loopPrice}% || || &bMethod: &f%{_type}% || ||&9Click to %{_menu}%!"
- else if {_menu} is "Sell":
- set slot {_x} of {_p}'s current inventory to loop-value of {_item} named "&c&l&n%{_menu}% %loop-value% times" with lore " || &eTotal Price: &f$%{_loopPrice}% || || &bMethod: &f%{_type}% || ||&9Click to %{_menu}%!"
- #else if {_type} is "PlayerPoints":
- # set slot {_x} of {_p}'s current inventory to loop-value of {_item} named "&cSoon!"
- add 1 to {_x}
- if {_amount} is not set:
- set {_amount} to 1
- set {_customPrice} to ({_amount} * {_price})
- if {_item} is "emerald_item":
- set {_item1} to emerald block
- else:
- set {_item1} to emerald item
- set slot 14 of {_p}'s current inventory to 1 of {_item1} named "&6&l&n%{_menu}% Custom Amount" with lore " || &bMethod: &f%{_type}% || ||&9Click to %{_menu}%!"
- if {_menu} is "Buy":
- set slot 16 of {_p}'s current inventory to light green wool block named "&2&l&nBuying Mode" with lore " || &7Click to switch! || "
- else if {_menu} is "Sell":
- set slot 16 of {_p}'s current inventory to red wool block named "&c&l&nSelling Mode" with lore " || &7Click to switch! || "
- #loop 5 times:
- # set slot loop-value of {_p}'s current inventory to red glass pane
- # add 1 to {_x}
- if {_pl} > 1:
- set slot 26 of {_p}'s current inventory to book named "&a&lPayment Method" with lore " || &7» &cSell with Balance || &7» &eBuy with Points || &7» "
- if slot 0 of {_p}'s current inventory is not gray glass pane:
- set {_y::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25 and 26
- loop {_y::*}:
- uncoloured inventory name of {_p}'s current inventory contains "» Shop Menu"
- if {FSShop::ShopSettings::GlassColor::%{_id}%} is not set:
- set {FSShop::ShopSettings::GlassColor::%{_id}%} to gray glass pane
- set slot loop-value of {_p}'s current inventory to {FSShop::ShopSettings::GlassColor::%{_id}%}
- #-----------------------------------------------------------------#
- # THE FUNCTION OF OPENING THE MENU OF A STORE #
- #-----------------------------------------------------------------#
- function FunnyServerShop_RefreshStore(p: player , id: text , page: integer):
- set {_uuid} to uuid of {_p}
- set {_x} to 10
- if size of {FSShop::StoreSettings::SoldItems::%{_id}%::*} > 0:
- set {_c} to 0
- set {_prev} to ({_page} - 1)
- set {_next} to ({_page} + 1)
- set slot 34 of {_p}'s current inventory to shiny arrow named "&7&l&nGo to Page %{_next}%"
- if {_page} > 1:
- set slot 28 of {_p}'s current inventory to shiny arrow named "&7&l&nGo to Page %{_prev}%"
- loop {FSShop::StoreSettings::SoldItems::%{_id}%::*}:
- if {_page} = 1:
- if ({_page} * 19) >= {_c}:
- add loop-value to {_items::*}
- else:
- stop loop
- add 1 to {_c}
- else:
- if ({_page} * 19) >= {_c}:
- {_c} >= ({_prev} * 19) + 1
- add loop-value to {_items::*}
- else:
- stop loop
- add 1 to {_c}
- # else:
- # if ({_page} * 19) >= {_c}:
- # {_c} >= ({_prev} * 20)
- # add loop-value to {_items::*}
- # else:
- # stop loop
- # add 1 to {_c}
- wait 1 tick
- set {_x} to 10
- loop {_items::*}:
- set {_itemF} to "%loop-value%" parsed as text
- set {_itemI} to "%loop-value%" parsed as item
- set {_item1} to "%loop-value%" parsed as item
- disenchant {_item1}
- set {_item} to "%{_item1}%" converted to all uppercase
- if {FSShop::StoreSettings::%{_itemF}%::Buyable::%{_id}%} is "Disabled":
- set {_buyText} to "&6&oNot Buyable"
- else:
- set {_buyText} to "&a$%{FSShop::StoreSettings::%{_itemF}%::BuyingPrice::%{_id}%}%"
- if {FSShop::StoreSettings::%{_itemF}%::Sellable::%{_id}%} is "Disabled":
- set {_sellText} to "&6&oNot Sellable"
- else:
- set {_sellText} to "&c$%{FSShop::StoreSettings::%{_itemF}%::SellingPrice::%{_id}%}%"
- if {_x} is 28:
- {_page} > 1
- add 1 to {_x}
- set slot {_x} of {_p}'s current inventory to 1 of {_itemI} named "&e&l&n%{_item}%" with lore " || &7Buy Price: %{_buyText}% || || &7Sell Price: %{_sellText}%|| || ||&a&oLeft Click to buy.||&c&oRight Click to sell."
- if {_x} is 16 or 25:
- add 3 to {_x}
- else:
- add 1 to {_x}
- else:
- set slot 22 of {_p}'s current inventory to redstone block named "&c&l&nNo Items found!"
- set slot 45 of {_p}'s current inventory to book named "&a&l&nMore Information" with lore " || &fLeft Click &7on the Item you want to buy or sell. || &7It will popup a new menu where you can select the amount. || &7You can also use the &fdrop button &7to directly buy items, || &7by typing in the chat what amount you want to buy. || "
- set slot 53 of {_p}'s current inventory to name tag named "&b&l&nFilter Items" with lore " || &f» All Items || &8» Available || &8» On Sale || &8» Buyable || &8» Out of Stock || ||&9Click to switch."
- wait 1 tick
- if slot 0 of {_p}'s current inventory is not gray glass pane or red glass pane:
- set {_y::*} to 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46 and 52
- loop {_y::*}:
- uncoloured inventory name of {_p}'s current inventory contains "» Store Menu"
- if size of {_items::*} > 0:
- set slot loop-value of {_p}'s current inventory to {FSShop::StoreSettings::GlassColor::%{_id}%}
- else:
- set slot loop-value of {_p}'s current inventory to red glass pane
- if {FSShop::PlayerStats::StoreItemSelected::%{_uuid}%} is not set:
- set {_z::*} to 47, 48, 49, 50 and 51
- loop {_z::*}:
- set slot loop-value of {_p}'s current inventory to black glass pane named "&7&l&nNo Item Selected." with lore " || &fSelect an Item by clicking on || &fan slot as shown above. || "
- delete {_items::*}
- #-------------------------------------------------------------------------#
- # THE SYSTEM OF SELLING AND BUYING ITEMS IN THE MENU #
- #-------------------------------------------------------------------------#
- function FunnyServerShop_SellBuyItem(p: player , type: text , price: number , amount: integer , item: item , method: text):
- set {_uuid} to uuid of {_p}
- set {_totalPrice} to ({_price} * {_amount})
- if "%all of the enchantments of {_item}%" is not "<none>":
- set {_enchants::*} to all of the enchantments of {_item}
- set {_item2} to "%{_item}%" parsed as item
- loop {_enchants::*}:
- enchant {_item2} with loop-value
- if "%{_amount}%" is "<none>":
- message "%{FSShop::ChatPrefix}%&cError! The amount hasn't been saved, maybe the Server lagged?" to {_p}
- stop
- if "%{_price}%" is "<none>":
- message "%{FSShop::ChatPrefix}%&cError! The Price hasn't been been saved, maybe the Server lagged?" to {_p}
- stop
- if {_type} is set:
- if {_type} is "Buy":
- #message "AMOUNT = (%{_amount}%) en ITEM = (%{_item}%)" to {_p}
- if {_p} has enough space for {_amount} of {_item2}:
- if {_method} is "Balance":
- if balance of {_p} >= {_totalPrice}:
- remove {_totalPrice} from balance of {_p}
- give {_amount} of {_item2} to {_p}
- if {_amount} is "8 " or "32" or "64":
- message "%{FSShop::ChatPrefix}%&aYou've bought &f%{_item}% &afor &f$%{_totalPrice}%" to {_p}
- message "[FunnyShop] &7%{_p}% bought %{_item}% for $%{_totalPrice}%" to console
- else:
- message "%{FSShop::ChatPrefix}%&aYou've bought &f%{_amount}%x %{_item}% &afor &f$%{_totalPrice}%" to {_p}
- message "[FunnyShop] &7%{_p}% bought %{_amount}%x %{_item}% for $%{_totalPrice}%" to console
- else:
- message "%{FSShop::ChatPrefix}%&cYou don't have enough money for this!" to {_p}
- else:
- message "%{FSShop::ChatPrefix}%&cNo PlayerPoints support yet!" to {_p}
- #if player points of {_p} >= {_totalPrice}:
- # remove {_totalPrice} from the player points of {_p}
- # give {_amount} of {_item} to {_p}
- # if "%{_item}%" contains "8" or "32" or "64":
- # message "%{FSShop::ChatPrefix}%&aYou've bought &f%{_item}% &afor &f$%{_totalPrice}%" to {_p}
- # else:
- # message "%{FSShop::ChatPrefix}%&aYou've bought &f%{_amount}% %{_item}% &afor &f$%{_totalPrice}%" to {_p}
- #else:
- # message "%{FSShop::ChatPrefix}%&cYou haven't got enough points for this!"
- else:
- message "%{FSShop::ChatPrefix}%&cYou don't have enough inventory space left!" to {_p}
- else if {_type} is "Sell":
- if {_method} is "Balance":
- if amount of {_item2} in {_p}'s inventory >= {_amount}:
- add {_totalPrice} to balance of {_p}
- remove {_amount} of {_item2} from {_p}'s inventory
- message "%{FSShop::ChatPrefix}%&eYou've successfully sold &f%{_amount}%x %{_item2}% &efor &f$%{_totalPrice}%" to {_p}
- message "[FunnyShop] &7%{_p}% sold %{_amount}%x %{_item2}% for $%{_totalPrice}%" to console
- else:
- message "%{FSShop::ChatPrefix}%&cYou don't have enough items to do this!" to {_p}
- else:
- message "%{FSShop::ChatPrefix}%&cNo PlayerPoints support yet!" to {_p}
- else:
- message "%{FSShop::ChatPrefix}%&cCouldn't find if you wanted to sell or buy!" to {_p}
- else:
- message "%{FSShop::ChatPrefix}%&cCouldn't select if you wanted to sell or buy!" to {_p}
- on chat:
- if {FSShop::PlayerStats::TypingCustomType::%uuid of player%} is set:
- cancel event
- if message is "all":
- if {FSShop::PlayerStats::TypingCustomType::%uuid of player%} is "Sell":
- set {_amount1} to the number of "%{FSShop::PlayerStats::TypingCustomItem::%uuid of player%}%" parsed as item in player's inventory
- set {_amount} to "%{_amount1}%" parsed as integer
- set {_p} to player
- if {_amount} > 0:
- FunnyServerShop_SellBuyItem({_p} , {FSShop::PlayerStats::TypingCustomType::%uuid of player%} , {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%} , {_amount} , {FSShop::PlayerStats::TypingCustomItem::%uuid of player%} , {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%})
- else:
- message "%{FSShop::ChatPrefix}%&cYou can't sell items you don't have in your inventory!"
- else:
- message "%{FSShop::ChatPrefix}%&cYou can't buy all items! You can only sell all items!"
- else:
- set {_m1} to message parsed as integer
- if "%{_m1}%" is not "<none>":
- set {_m2} to "%{_m1}%" parsed as integer
- if {_m2} is "<none>":
- message "%{FSShop::ChatPrefix}%&cYou need to enter an number with 0 decimals!"
- else:
- if {_m1} > 0:
- set {_p} to player
- FunnyServerShop_SellBuyItem({_p} , {FSShop::PlayerStats::TypingCustomType::%uuid of player%} , {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%} , {_m2} , {FSShop::PlayerStats::TypingCustomItem::%uuid of player%} , {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%})
- else:
- message "%{FSShop::ChatPrefix}%&cYou can't %{FSShop::PlayerStats::TypingCustomType::%uuid of player%}% 0 Items!"
- else:
- message "%{FSShop::ChatPrefix}%&cFailed to find exact number. Do only type numbers!"
- wait 5 ticks
- delete {FSShop::PlayerStats::TypingCustomType::%uuid of player%}
- delete {FSShop::PlayerStats::TypingCustomPrice::%uuid of player%}
- delete {FSShop::PlayerStats::TypingCustomAmount::%uuid of player%}
- delete {FSShop::PlayerStats::TypingCustomItem::%uuid of player%}
- delete {FSShop::PlayerStats::TypingCustomMethod::%uuid of player%}
- else if {FSShop::PlayerStats::TypingShopName::%uuid of player%} is set:
- set {_id} to {FSShop::PlayerStats::TypingShopName::%uuid of player%}
- set {_type} to {FSShop::PlayerStats::TypingShopType::%uuid of player%}
- set {_trigger} to {FSShop::PlayerStats::TypingShopTrigger::%uuid of player%}
- replace all " " with "" in {_id}
- cancel event
- #message "TRIGGER = (%{_trigger}%)"
- if {_trigger} is "NPC":
- loop all citizens:
- id of loop-citizen is {FSShop::%{_type}%Settings::NPCID::%{_id}%}
- set npc name of loop-citizen to coloured message
- set {_done} to true
- stop loop
- else if {_trigger} is "HOLOGRAM":
- set text in hologram {FSShop::%{_type}%Settings::Hologram::%{_id}%} to coloured message in line 0
- set {_done} to true
- else:
- set {_done} to true
- if {_done} is set:
- set {FSShop::%{_type}%Settings::NickName::%{_id}%} to coloured message
- message "%{FSShop::ChatPrefix}%&aYou've successfully changed the name to &f'%coloured message%&f'"
- else:
- message "%{FSShop::ChatPrefix}%&cCouldn't find the NPC you were looking for!"
- delete {FSShop::PlayerStats::TypingShopName::%uuid of player%}
- delete {FSShop::PlayerStats::TypingShopCType::%uuid of player%}
- delete {FSShop::PlayerStats::TypingShopTrigger::%uuid of player%}
- #set name of loop-entity to "%coloured message%"
- else if {FSShop::PlayerStats::TypingItemPriceID::%uuid of player%} is set:
- set {_id} to {FSShop::PlayerStats::TypingItemPriceID::%uuid of player%}
- set {_type} to {FSShop::PlayerStats::TypingItemPriceType::%uuid of player%}
- set {_method} to {FSShop::PlayerStats::TypingItemPriceMethod::%uuid of player%}
- set {_item} to {FSShop::PlayerStats::TypingItemPriceItem::%uuid of player%}
- cancel event
- set {_m2} to message
- replace all "," with "." in {_m2}
- set {_m1} to "%{_m2}%" parsed as number
- if "%{_m1}%" is not "<none>":
- if {_m1} > 0:
- if {_method} is "Store":
- set {FSShop::%{_method}%Settings::%{_item}%::%{_type}%ingPrice::%{_id}%} to {_m1}
- message "%{FSShop::ChatPrefix}%&aSuccessfully changed the &f%{_type}% Price &ato &f$%{_m1}%" to player
- else:
- message "%{FSShop::ChatPrefix}%&cNot Supported yet."
- else:
- message "%{FSShop::ChatPrefix}%&cYou can't buy 0 Items!"
- else:
- message "%{FSShop::ChatPrefix}%&cFailed to find exact number. Do only type numbers!"
- delete {FSShop::PlayerStats::TypingItemPriceID::%uuid of player%}
- delete {FSShop::PlayerStats::TypingItemPriceType::%uuid of player%}
- delete {FSShop::PlayerStats::TypingItemPriceMethod::%uuid of player%}
- delete {FSShop::PlayerStats::TypingItemPriceItem::%uuid of player%}
- else if {FSShop::PlayerStats::TypingCustomPluginPrefix::%uuid of player%} is set:
- cancel event
- set {FSShop::ChatPrefix} to "%coloured message% "
- message "%{FSShop::ChatPrefix}%&aYou've successfully changed the prefix to: &f'&r%{FSShop::ChatPrefix}%&f'."
- delete {FSShop::PlayerStats::TypingCustomPluginPrefix::%uuid of player%}
- #----------------------------------#
- # END OF FUNCTIONS CODE #
- #----------------------------------#
- #---------------------------------------------------------------#
- # THE FUNCTION OF DESTROYING A SHOP OR STORE #
- #---------------------------------------------------------------#
- function FunnyServerShop_DestroyShop(p: player , method: text , type: text , id: text , trigger: text):
- set {_uuid} to uuid of {_p}
- if {_method} is "ITEM_FRAME":
- message "%{FSShop::ChatPrefix}%&eYou need to destroy the Item Frame yourself. Sorry!" to {_p}
- else if {_method} is "HOLOGRAM":
- unregister hologram {FSShop::%{_type}%Settings::Hologram::%{_id}%}
- delete {FSShop::%{_type}%Settings::Hologram::%{_id}%}
- else if {_method} is "NPC":
- loop all created citizens:
- set {_NPCID} to id of loop-citizen
- "%{_NPCID}%" is "%{FSShop::%{_type}%Settings::NPCID::%{_id}%}%"
- set {_npc} to loop-citizen
- stop loop
- if {_npc} is set:
- destroy {_npc}
- delete {FSShop::%{_type}%Settings::NPCID::%{_id}%}
- else:
- message "%{FSShop::ChatPrefix}%&cCouldn't find the NPC! Remove it manually please." to {_p}
- else if {_method} is "SIGN":
- if block at {FSShop::%{_type}%Settings::Location::%{_id}%} is sign:
- set block at {FSShop::%{_type}%Settings::Location::%{_id}%} to air
- else:
- message "%{FSShop::ChatPrefix}%&cRemove the Sign manually please." to {_p}
- wait 2 ticks
- delete {FSShop::%{_type}%Settings::Location::%{_id}%}
- delete {FSShop::%{_type}%Settings::Entity::%{_id}%}
- delete {FSShop::%{_type}%Settings::ShopType::%{_id}%}
- if {_type} is "Store":
- loop {FSShop::StoreSettings::SoldItems::%{_id}%::*}:
- delete {FSShop::StoreSettings::%loop-value%::BuyingPrice::%{_id}%}
- delete {FSShop::StoreSettings::%loop-value%::SellingPrice::%{_id}%}
- delete {FSShop::StoreSettings::%loop-value%::Buyable::%{_id}%}
- delete {FSShop::StoreSettings::%loop-value%::Sellable::%{_id}%}
- delete {FSShop::StoreSettings::%loop-value%::MaxBuyAmount::%{_id}%}
- delete {FSShop::StoreSettings::%loop-value%::MaxSellAmount::%{_id}%}
- wait 1 tick
- delete {FSShop::StoreSettings::SoldItems::%{_id}%::*}
- else:
- delete {FSShop::ShopSettings::SoldItem::%{_id}%}
- delete {FSShop::ShopSettings::BuyingPrice::%{_id}%}
- delete {FSShop::ShopSettings::SellingPrice::%{_id}%}
- delete {FSShop::%{_type}%Settings::ShopOpened::%{_id}%}
- delete {FSShop::%{_type}%Settings::GlassColor::%{_id}%}
- remove "%{_id}%" from {FSShop::ListOf%{_type}%s::*}
- close {_p}'s inventory
- #if {_type} is "SIGN" or "ITEM_FRAME":
- if {_trigger} is "invClick":
- message "%{FSShop::ChatPrefix}%&dYou've successfully removed a %{_type}%. &7(ID: %{_id}%)" to {_p}
- else if {_trigger} is "destroy":
- message "%{FSShop::ChatPrefix}%&dYou've destroyed a %{_type}%. &7(ID: %{_id}%)" to {_p}
- #----------------------------------------------------------------------------#
- # THE REFRESHING SYSTEM OF AN HOLOGRAM SHOP OR STORE #
- #----------------------------------------------------------------------------#
- function FunnyServerShop_RefreshHolo(p: player , id: text):
- set {_uuid} to uuid of {_p}
- unregister hologram {FSShop::ShopSettings::Hologram::%{_id}%}
- delete {FSShop::ShopSettings::Hologram::%{_id}%}
- wait 1 tick
- set {_loc} to {FSShop::ShopSettings::Location::%{_id}%}
- set {FSShop::ShopSettings::Hologram::%{_id}%} to new hologram at {_loc}
- set location of hologram {FSShop::ShopSettings::Hologram::%{_id}%} to {_loc}
- wait 3 ticks
- add text "&a&l$%{FSShop::ShopSettings::BuyingPrice::%{_id}%}% &8| &c&l$%{FSShop::ShopSettings::SellingPrice::%{_id}%}%" to hologram {FSShop::ShopSettings::Hologram::%{_id}%}
- wait 2 ticks
- add item {FSShop::ShopSettings::SoldItem::%{_id}%} to hologram {FSShop::ShopSettings::Hologram::%{_id}%}
- wait 2 ticks
- add text "&6&nSneak to open" to hologram {FSShop::ShopSettings::Hologram::%{_id}%}
- #every second:
- # size of {FSShop::ListOfStores::*} > 0
- # loop {FSShop::ListOfStores::*}:
- # set {_id} to "%loop-value%"
- # {FSShop::StoreSettings::ShopType::%{_id}%} is "Hologram"
- # set {_item1} to a random text out of {FSShop::StoreSettings::SoldItems::%{_id}%::*}
- # set {_item} to "%{_item1}%" parsed as text
- # message "ITEM = (%{_item}%) en ITEM1 = (%{_item1}%)" to all ops
- # {_item} is set
- # message "Hey!" to all ops
- # unregister hologram {FSShop::StoreSettings::Hologram::%{_id}%}
- # delete {FSShop::StoreSettings::Hologram::%{_id}%}
- # set {_loc} to {FSShop::StoreSettings::Location::%{_id}%}
- # set location of hologram {FSShop::StoreSettings::Hologram::%{_id}%} to {_loc}
- # wait 1 ticks
- # add text "&6&l&nStore %{_id}%" to hologram {FSShop::StoreSettings::Hologram::%{_id}%}
- # wait 1 ticks
- # add item {_item} to hologram {FSShop::StoreSettings::Hologram::%{_id}%}
- # wait 1 ticks
- # add text "&7&l&nLeft Click to open." to hologram {FSShop::StoreSettings::Hologram::%{_id}%}
- #! THIS DOESN'T WORK VERY WELL; ADD IT IN FEATURE UPDATE » Refreshing Store Hologram by Shuffling between Sold Items.
- #set item in hologram {FSShop::StoreSettings::Hologram::%{_id}%} to {_item} at line 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement