Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.77 KB | None | 0 0
  1. on join:
  2. if {credit::%player%} is not set:
  3. set {credit::%player%} to 0
  4.  
  5. command /loan:
  6. trigger:
  7. if {loanalready::%{_p}%} is not set:
  8. set {loanamount::%player%} to 0
  9. set {days::%player%} to 0
  10. open virtual chest inventory with size 1 named "&e&lLoan" to player
  11. create a gui slot 0 of player with gray glass named "" to do nothing
  12. create a gui slot 1 of player with gray glass named "" to do nothing
  13. create a gui slot 2 of player with gray glass named "" to do nothing
  14. create a gui slot 4 of player with book named "&eLoan Money" with lore "&7Your credit: &a%{credit::%player%}%" to run function loans(player)
  15. create a gui slot 3 of player with paper named "&eInfo" with lore "&7How you can get your credit up||&7loan money and pay it back and your||&7credit will be better and you can loan more||&7Your credit can get better when you have||&7more money in your balance" to do nothing
  16. create a gui slot 6 of player with gray glass named "" to do nothing
  17. create a gui slot 7 of player with gray glass named "" to do nothing
  18. create a gui slot 8 of player with gray glass named "" to do nothing
  19. if {loan::%player%} is 10000:
  20. create a gui slot 5 of player with paper named "&eInfo" with lore "&7You can loan &a0-%{loan::%player%}%$" to do nothing
  21. else:
  22. message "&7You already have a loan pay it back with &a/payback"
  23. function loans(p: player):
  24. open virtual chest inventory with size 3 named "&e&lLoan Amount" to {_p}
  25. create a gui slot 9 of {_p} with green glass named "&e+&a100$" to run function add({_p}, 100)
  26. create a gui slot 10 of {_p} with green glass named "&e+&a1000$" to run function add({_p}, 1000)
  27. create a gui slot 11 of {_p} with green glass named "&e+&a10000$" to run function add({_p}, 10000)
  28. create a gui slot 12 of {_p} with green glass named "&e+&a100000$" to run function add({_p}, 100000)
  29. create a gui slot 13 of {_p} with book named "&e&lAmount" with lore "&7Loan Amount: &a%{loanamount::%{_p}%}%$" to run function amountloan({_p})
  30. create a gui slot 14 of {_p} with red glass named "&e-&c100000$" to run function remove({_p}, 100000)
  31. create a gui slot 15 of {_p} with red glass named "&e-&c10000$" to run function remove({_p}, 10000)
  32. create a gui slot 16 of {_p} with red glass named "&e-&c1000$" to run function remove({_p}, 1000)
  33. create a gui slot 17 of {_p} with red glass named "&e-&c100$" to run function remove({_p}, 100)
  34. create a gui slot 4 of {_p} with green glass named "&aLoan the max amount" to run function max({_p}, 100)
  35. create a gui slot 22 of {_p} with red glass named "&cReset the loan amount" to run function reset({_p})
  36.  
  37. function max(p: player):
  38. if {credit::%{_p}%} is 0:
  39. set {loanamount::%{_p}%} to 10000
  40. create a gui slot 13 of {_p} with book named "&e&lAmount" with lore "&7Loan Amount: &a%{loanamount::%{_p}%}%$" to run function amountloan({_p})
  41.  
  42. function reset(p: player):
  43. set {loanamount::%{_p}%} to 0
  44. create a gui slot 13 of {_p} with book named "&e&lAmount" with lore "&7Loan Amount: &a%{loanamount::%{_p}%}%$" to run function amountloan({_p})
  45.  
  46. function add(p: player, n: integer):
  47. add {_n} to {loanamount::%{_p}%}
  48. create a gui slot 13 of {_p} with book named "&e&lAmount" with lore "&7Loan Amount: &a%{loanamount::%{_p}%}%$" to run function amountloan({_p})
  49.  
  50. function remove(p: player, n: integer):
  51. if {loanamount::%{_p}%} is not less than 1:
  52. remove {_n} from {loanamount::%{_p}%}
  53. create a gui slot 13 of {_p} with book named "&e&lAmount" with lore "&7Loan Amount: &a%{loanamount::%{_p}%}%$" to run function amountloan({_p})
  54. else:
  55. message "&7You can't have a negative number" to {_p}
  56.  
  57. function amountloan(p: player):
  58. set {days::%{_p}%} to 0
  59. if {credit::%{_p}%} is 0:
  60. if {loanamount::%{_p}%} is not higher than 10000:
  61. if {loanamount::%{_p}%} is not 0:
  62. days({_p})
  63. else:
  64. message "&7You can't loan &a0$" to {_p}
  65. else:
  66. message "&7You can only loan between &a0-%{loan::%{_p}%}%$" to {_p}
  67. message "&7Becuase your credit is &a%{credit::%{_p}%}%" to {_p}
  68.  
  69. function days(P: player):
  70. open virtual chest inventory with size 3 named "&e&lDays" to {_p}
  71. create a gui slot 9 of {_p} with green glass named "&e+&a1 Days" to run function daysadd({_p}, 1)
  72. create a gui slot 10 of {_p} with green glass named "&e+&a2 Days" to run function daysadd({_p}, 2)
  73. create a gui slot 11 of {_p} with green glass named "&e+&a5 Days" to run function daysadd({_p}, 5)
  74. create a gui slot 12 of {_p} with green glass named "&e+&a10 Days" to run function daysadd({_p}, 10)
  75. create a gui slot 13 of {_p} with book named "&e&lDays" with lore "&7Days: &a%{days::%{_p}%}%" to run function confirmloan({_p})
  76. create a gui slot 14 of {_p} with red glass named "&e-&c10 Days" to run function daysremove({_p}, 10)
  77. create a gui slot 15 of {_p} with red glass named "&e-&c5 Days" to run function daysremove({_p}, 5)
  78. create a gui slot 16 of {_p} with red glass named "&e-&c2 Days" to run function daysremove({_p}, 2)
  79. create a gui slot 17 of {_p} with red glass named "&e-&c1 Days" to run function daysremove({_p}, 1)
  80. create a gui slot 4 of {_p} with green glass named "&aMax days" to run function maxdays({_p})
  81. create a gui slot 22 of {_p} with red glass named "&cReset the days amount" to run function resetdays({_p})
  82.  
  83. function maxdays(p: player):
  84. if {credit::%{_p}%} is 0:
  85. set {days::%{_p}%} to 10
  86. create a gui slot 13 of {_p} with book named "&e&lDays" with lore "&7Days: &a%{days::%{_p}%}%" to run function confirmloan({_p})
  87.  
  88. function resetdays(p: player):
  89. set {days::%{_p}%} to 0
  90. create a gui slot 13 of {_p} with book named "&e&lDays" with lore "&7Days: &a%{days::%{_p}%}%" to run function confirmloan({_p})
  91. function daysadd(p: player, n: integer):
  92. add {_n} to {days::%{_p}%}
  93. create a gui slot 13 of {_p} with book named "&e&lDays" with lore "&7Days: &a%{days::%{_p}%}%" to run function confirmloan({_p})
  94.  
  95. function daysremove(p: player, n: integer):
  96. if {days::%{_p}%} is not 0:
  97. if {days::%{_p}%} is not less than 1:
  98. remove {_n} from {days::%{_p}%}
  99. create a gui slot 13 of {_p} with book named "&e&lDays" with lore "&7Days: &a%{days::%{_p}%}%" to run function confirmloan({_p})
  100. else:
  101. message "&7You can't have a negative number" to {_p}
  102. else:
  103. message "&7You can't loan &a0 days" to {_p}
  104.  
  105. ########################
  106. # Loan System (need a better one)
  107. #######################
  108.  
  109. function confirmloan(p: player):
  110. if {days::%{_p}%} is not higher than 10:
  111. open virtual chest inventory with size 3 named "&e&lConfirm loan" to {_p}
  112. create a gui slot 13 of {_p} with book named "&e&lConfirm" with lore "&7Amount: &a%{loanamount::%{_p}%}%$||&7Days: &a%{days::%{_p}%}%" to run function loanrun({_p})
  113. create a gui slot 4 of {_p} with red glass named "&CCancel" to close
  114. create a gui slot 22 of {_p} with red glass named "&CCancel" to close
  115. else:
  116. message "&7You can't loan more then &a10 &7days becuase your credit is &a%{credit::%{_p}%}%" to {_p}
  117.  
  118.  
  119.  
  120. function loanrun(p: player):
  121. execute console command "eco give %player% %{loanamount::%{_p}%}%"
  122. set {loanalready::%{_p}%} to true
  123. message "&7You have loaned &a%{loanamount::%{_p}%}%" to {_p}
  124. message "&7You have to pay back in &a%{days::%{_p}%}%" to {_p}
  125.  
  126.  
  127.  
  128. every 1 day:
  129. if {credit::%player%} is 0:
  130. if {days::%player%} is not 0:
  131. if {loanalready::%player%} is true:
  132. remove 1 from {days::%{_p}%}
  133. message "&7You now have &a%{days::%{_p}%}%" to player
  134.  
  135. every 1 day:
  136. if {days::%player%} is less than 2:
  137. if {loanalready::%player%} is true:
  138. message "&7You have 1 day before you have to pay back" to player
  139.  
  140. every 1 day:
  141. if {days::%player%} is 0:
  142. if {loanalready::%player%} is true:
  143. set {payback::%player%} to "%players balance%"
  144. remove {payback::%player%} from players balance
  145. message "Your balance has been removed becuase you didnt pay your loan"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement