C_Corp2002

Fabricator Code

Jun 24th, 2021
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. ###Code###
  2. function pricing(blocktype: material, player: player, amount: number) :: objects:
  3. wait 2 ticks
  4. #message "Fabricator - DBG : Testing Pricing Function" to console
  5. if {_blocktype} contains bedrock or barrier or netherite block or ancient debris or crying obsidian or obsidian or command block or structure block or piston head or end portal frame or end portal or end gateway or nether portal:
  6. message "{@prefix}: ERROR - Invalid Block : ""%{_blocktype}%""" to {_player}
  7. set {TruFal.%{_player}%} to true
  8. set {total.%{_player}%} to 100000000000000000000000
  9. stop
  10. else:
  11. set {_price} to yaml value "prices.%{_blocktype}%" from file "plugins/Skript/scripts/Fabricator/FabricatorPrices.yml"
  12. wait 2 ticks
  13. if {_blocktype} is not air:
  14. wait 2 ticks
  15. if {_price} is number:
  16. message "{@prefix}:&r Price of %{_blocktype}% is set to %{_price}%" to {_player}
  17. if {_player}'s money >= ({_price} * {_amount}):
  18. wait 2 ticks
  19. set {_price} to {_price} * {_amount}
  20. message "{@prefix}:&r Charging %{_player}% - %{_price}% Credits for (%{_amount}% x ""%{_blocktype}%"")." to {_player}
  21. add {_price} to {total.%{_player}%}
  22. wait 1 tick
  23. set {TruFal.%{_player}%} to true
  24. else:
  25. message "{@prefix}:&r Insufficient Balance %{_player}% - %{_price}% Credits" to {_player}
  26. set {TruFal.%{_player}%} to false
  27. else:
  28. wait 2 ticks
  29. set {_price} to 75
  30. message "{@prefix}:&r Price of ""%{_blocktype}%"" is Unknown..." to {_player}
  31. message "{@prefix}:&r Defaulting to %{_price}%" to {_player}
  32. if {_player}'s money >= ({_price} * {_amount}):
  33. set {_price} to {_price} * {_amount}
  34. message "{@prefix}:&r Charging %{_player}% - %{_price}% Credits for (%{_amount}% x ""%{_blocktype}%"")." to {_player}
  35. add {_price} to {total.%{_player}%}
  36. wait 1 tick
  37. set {TruFal.%{_player}%} to true
  38. else:
  39. message "{@prefix}:&r &cInsufficient Balance&r %{_player}% - %{_price}% Credits" to {_player}
  40. set {TruFal.%{_player}%} to false
  41. else:
  42. wait 2 ticks
  43. set {_price} to 0
  44. message "{@prefix}:&r Price of ""%{_blocktype}%"" is %{_price}%..." to {_player}
  45. if {_player}'s money >= ({_price} * {_amount}):
  46. set {_price} to {_price} * {_amount}
  47. message "{@prefix}:&r Charging %{_player}% - %{_price}% Credits for (%{_amount}% x ""%{_blocktype}%"")." to {_player}
  48. add {_price} to {total.%{_player}%}
  49. wait 1 tick
  50. set {TruFal.%{_player}%} to true
  51. else:
  52. message "{@prefix}:&r &cInsufficient Balance&r %{_player}% - %{_price}% Credits" to {_player}
  53. set {TruFal.%{_player}%} to false
Advertisement
Add Comment
Please, Sign In to add comment