Advertisement
HydraACDev

Hydra Eco

Dec 14th, 2020
59
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None
  1. #Hydra Eco
  2. #Economy based skript, using functions
  3. #addBal(player, money), add money to a player
  4. #getBal(player), returns the ammount of money a player has
  5. #removeBal(player, money), removes the specified amount of money from a player (Can be a negative, change the option "negativebal" to true)
  6. #setBal(player, money), sets a players bal to the specified amount of money
  7.  
  8. options:
  9. NP: &c&lHydra Eco &8» &cInvalid Permissions
  10. negativebal: false
  11.  
  12. function addBal(p: player, m: number):
  13. add {_m} to {money::%{_p}%}
  14.  
  15. function getBal(p: player) :: number:
  16. if {money::%{_p}%} is not set:
  17. set {money::%{_p}%} to 0
  18. return {money::%{_p}%}
  19.  
  20. function removeBal(p: player, m: number):
  21. if {@negativebal} is false:
  22. if {_m} > {money::%{_p}%}:
  23. message "&cA player cant have a negative balance" to console
  24. stop
  25. remove {_m} from {money::%{_p}%}
  26.  
  27. function setBal(p: player, m: number):
  28. set {money::%{_p}%} to {_m}
  29.  
  30. command /money [<text>] [<number>] [<offline player>]:
  31. trigger:
  32. if arg 1 is set:
  33. if arg 2 is set:
  34. if arg 1 is "give", "g" or "add":
  35. if player has permission "HydraEco.addmoney":
  36. addBal(arg 3, arg 2)
  37. send "&cAdded %arg 2%&c to %arg 3%&c's balance"
  38. else:
  39. send "{@NP}"
  40. else if arg 1 is "remove", "r" or "take":
  41. if player has permission "HydraEco.removemoney":
  42. removeBal(arg 3, arg 2)
  43. send "&cRemoved %arg 2%&c from %arg 2%&c's bal. Check console for more information if it didnt work."
  44. else:
  45. send "{@NP}"
  46. else if arg 1 is "set" or "s":
  47. if player has permission "HydraEco.setmoney":
  48. setBal(arg 3, arg 2)
  49. send "&cSet %arg 3%&c's bal to %arg 2%"
  50. else:
  51. send "&c&lHydra Eco"
  52. send "&c/money <add/remove/set> <money> <player>"
  53. send "&c&lHydra Eco"
  54. else:
  55. send "&c&lHydra Eco"
  56. send "&c/money <add/remove/set> <money> <player>"
  57. send "&c&lHydra Eco"
  58.  
  59. command /bal [<offline player>]:
  60. permission: HydraEco.bal
  61. permission message: {@NP}
  62. trigger:
  63. if arg 1 is set:
  64. send "&c%arg 1%&c's balance: %{money::%arg 1%}%"
  65. else:
  66. send "&cYour balance: %{money::%player%}%"
  67.  
  68. command /pay [<offline player>] [<number>]:
  69. trigger:
  70. if arg 1 is set:
  71. if arg 2 is set:
  72. if player has permission "HydraEco.pay":
  73. if getBal(player) >= arg 2:
  74. removeBal(player, arg 2)
  75. addBal(arg 1, arg 2)
  76. send "&b$%arg 2%&7 has been sent to &b%arg 1%"
  77. send "&b%arg 2%&7 has been recieved from &b%player%" to arg 1
  78. else:
  79. send "&cYou do not have enough money to send to that player!"
  80. else:
  81. send "{@NP}"
  82. else:
  83. send "&c/pay <player> <amount>"
  84. else:
  85. send "&c/pay <player> <amount>"
Advertisement
RAW Paste Data Copied
Advertisement