Advertisement
laivytkill

DanielSK-Trade.sk (Versão 1.8.8)

May 21st, 2021
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.40 KB | None | 0 0
  1. # Código desenvolvido por DanielZinh#7616
  2. # LoS Skripters - EliteSK
  3.  
  4. options:
  5.  
  6. # Apertar com o direito + shift em um player para oferecer troca
  7. ShiftTroca: true
  8.  
  9. # Estar perto para realizar trocas
  10. NecessarioEstarPerto: true
  11. DistanciaMinima: 20 # Blocos
  12.  
  13. on unload:
  14. delete {troca::*}
  15.  
  16. command /trade [<player>]:
  17. aliases: trocar
  18. trigger:
  19. if arg 1 is not set:
  20. send "&cUse /trade (player)"
  21. else if {troca::%player%::*} contains player:
  22. send "&cEsse jogador já possui um pedido de troca seu"
  23. else:
  24. if "%{troca::%player%::*}%" doesn't contain "%arg-1%":
  25. if {troca::%arg-1%::*} contains player:
  26. send "&cVocê já enviou um pedido de troca para esse jogador"
  27. stop
  28. if {@NecessarioEstarPerto} is true:
  29. distance between arg-1 and player > {@DistanciaMinima}
  30. send "&cVocê está muito longe do jogador." to player
  31. stop
  32. send "&f%player% &7enviou um pedido de troca para você, utilize &f/trade %player% &7para aceitar" to arg-1
  33. send "&7Você enviou um pedido de troca para &f%arg-1%&7." to player
  34. add player to {troca::%arg-1%::*}
  35. else:
  36. if {troca::%player%::*} doesn't contain arg-1:
  37. send "&cEsse jogador não enviou um pedido de troca para você."
  38. else if arg-1 is not online:
  39. send "&cEsse jogador não está mais on-line."
  40. else if {var::%arg-1%::troca} is set:
  41. send "&cEsse jogador já está em uma troca."
  42. else:
  43. loop all players:
  44. loop-player is arg-1 or player
  45. open chest with 6 rows named "&eTroca %arg-1%" to loop-player
  46. clear {troca::%arg-1%::*} and {troca::%player%::*}
  47. set {var::%loop-player%::troca} to arg-1
  48. set {var::%arg-1%::troca} to loop-player
  49. set {var::%arg-1%::trocad} to arg-1
  50. set {var::%loop-player%::trocad} to arg-1
  51. wait 1 tick
  52. if name of loop-player's current inventory contains "&eTroca":
  53. set {_e::*} to split "4,13,22,31,30,29,28,27,40,49,50,51" at ","
  54. loop {_e::*}:
  55. set slot (loop-value-2 parsed as number) of loop-player's current inventory to black stained glass pane
  56. set slot 36 of loop-player's current inventory to red stained glass pane named "&6-R$100" with lore "||&cClique para subtrair||&cesse valor da troca||"
  57. set slot 45 of loop-player's current inventory to red stained glass pane named "&6-R$5,000" with lore "||&cClique para subtrair||&cesse valor da troca||"
  58.  
  59. set slot 37 of loop-player's current inventory to gold nugget named "&eSaldo: &6R$0" with lore "||&7Esse valor será enviado||&7ao usuário na conclusão||&7da troca.||"
  60. set slot 46 of loop-player's current inventory to dye:8 named "&aConfirmar troca" with lore "||&7Clique para confirmar||&7essa troca.||||&7Lembrando que o usuário||&7também precisa confirmar||&7para que a troca seja||&7bem-sucedida.||"
  61.  
  62. set slot 38 of loop-player's current inventory to light green stained glass pane named "&2+R$100" with lore "||&aClique para adicionar||&aesse valor à troca||"
  63. set slot 47 of loop-player's current inventory to light green stained glass pane named "&2+R$1,000" with lore "||&aClique para adicionar||&aesse valor à troca||"
  64. set slot 39 of loop-player's current inventory to light green stained glass pane named "&2+R$10,000" with lore "||&aClique para adicionar||&aesse valor à troca||"
  65. set slot 48 of loop-player's current inventory to light green stained glass pane named "&2+R$50,000" with lore "||&aClique para adicionar||&aesse valor à troca||"
  66.  
  67. set slot 53 of loop-player's current inventory to gold block named "&eSaldo: &6R$0" with lore "||&7Esse é o saldo que o||&7usuário te dará caso a||&7troca seja bem-sucedida.||"
  68. set slot 52 of loop-player's current inventory to red wool block named "&cNão-confirmado" with lore "&5||&7Indica se o usuário||&7confirmou ou não a troca.||&5"
  69.  
  70. on inventory close:
  71. if name of player's current inventory contains "&eTroca":
  72. {var::%player%::trocad} is set
  73. set {_numbers::*} to split "0,1,2,3,9,10,11,12,18,19,20,21" at ","
  74. loop all players:
  75. {var::%loop-player%::trocad} is {var::%player%::trocad}
  76. add loop-player to {_p::*}
  77. loop {_numbers::*}:
  78. slot loop-value-2 parsed as number of loop-value-1's current inventory is not air
  79. give slot loop-value-2 parsed as number of loop-value-1's current inventory to loop-value-1
  80. loop {_p::*}:
  81. delete {var::%loop-value%::troca}
  82. delete {troca::%loop-value%::*}
  83. delete {var::%loop-value%::trocad}
  84. if loop-value is not player:
  85. close loop-value's inventory
  86. clear {troca::%{var::%loop-value%::trocad}%::*}
  87. delete {var::%loop-value%::trocad}
  88. send "&cA troca foi cancelada por %player%&c." to loop-value
  89. on inventory click:
  90. if name of player's current inventory contains "&eTroca":
  91. cancel event
  92. set {_numbers::*} to split "0,1,2,3,9,10,11,12,18,19,20,21" at ","
  93. if "%clicked inventory%" is "inventory of %player%":
  94. if slot 46 of player's current inventory is dye:10:
  95. send "&cVocê não pode fazer alterações enquanto estiver com a troca confirmada."
  96. stop
  97. loop {_numbers::*}:
  98. slot loop-value parsed as number of player's current inventory is air
  99. add clicked item to {troca::%{var::%player%::trocad}%::*}
  100. set slot loop-value parsed as number of player's current inventory to clicked item
  101. loop all players:
  102. loop-player is not player
  103. {var::%player%::trocad} is {var::%loop-player%::trocad}
  104. set slot loop-value-1 parsed as number + 5 of loop-player's current inventory to clicked item
  105. remove clicked item from player's inventory
  106. stop loop
  107. else:
  108. clicked item is set
  109.  
  110. if slot 46 of player's current inventory is dye:10:
  111. if {_numbers::*} contains "%clicked slot%":
  112. send "&cVocê não pode fazer alterações enquanto estiver com a troca confirmada."
  113. stop
  114. else if clicked slot is 36, 38, 39, 45, 47 or 48:
  115. send "&cVocê não pode fazer alterações enquanto estiver com a troca confirmada."
  116. stop
  117. else:
  118. clicked slot is not 46
  119. slot 52 of player's current inventory is green wool block
  120. set {_item} to red wool block named "&cNão-confirmado" with lore "||&7Indica se o usuário||&7confirmou ou não a troca.||"
  121. set slot 52 of player's current inventory to {_item}
  122. loop all players:
  123. loop-player is not player
  124. {var::%player%::trocad} is {var::%loop-player%::trocad}
  125. set slot 46 of loop-player's current inventory to dye:8 named "&aConfirmar troca" with lore "||&7Clique para confirmar||&7essa troca.||||&7Lembrando que o usuário||&7também precisa confirmar||&7para que a troca seja||&7bem-sucedida.||"
  126.  
  127.  
  128. if {_numbers::*} contains "%clicked slot%":
  129. remove clicked item from {troca::%{var::%player%::trocad}%::*}
  130. add clicked item to player's inventory
  131. loop all players:
  132. loop-player is not player
  133. {var::%player%::trocad} is {var::%loop-player%::trocad}
  134. set slot clicked slot + 5 of loop-player's current inventory to air
  135. set slot clicked slot of player's current inventory to air
  136. else if clicked slot is 36, 38, 39, 45, 47 or 48:
  137. set {_actual} to uncolored name of slot 37 of player's current inventory
  138. set {_value} to uncolored name of clicked item
  139. replace all "Saldo: R$", "-", "+", "R$" and "," with "" in {_value}
  140. replace all "Saldo: R$", "-", "+", "R$" and "," with "" in {_actual}
  141. set {_value} to {_value} parsed as number
  142. set {_actual} to {_actual} parsed as number
  143. set {_d} to {_actual}
  144.  
  145. if name of clicked item contains "&6":
  146. remove {_value} from {_d}
  147. {_d} < 0
  148. set {_d} to 0
  149. else:
  150. if player's balance < {_actual} + {_value}:
  151. send "&cVocê não possui dinheiro para isso."
  152. else:
  153. add {_value} to {_d}
  154.  
  155. else if clicked slot is 46:
  156. if name of clicked item is "&cCancelar troca":
  157. set {_item} to red wool block named "&cNão-confirmado" with lore "||&7Indica se o usuário||&7confirmou ou não a troca.||"
  158. set slot 46 of player's current inventory to dye:8 named "&aConfirmar troca" with lore "||&7Clique para confirmar||&7essa troca.||||&7Lembrando que o usuário||&7também precisa confirmar||&7para que a troca seja||&7bem-sucedida.||"
  159. else:
  160. set {_item} to green wool block named "&aConfirmado" with lore "||&7Agora confirme você também||&7para finalizar a troca!||"
  161. set slot 46 of player's current inventory to dye:10 named "&cCancelar troca" with lore "||&7Clique para cancelar||&7essa troca.||||&7Lembrando que o usuário||&7também precisa confirmar||&7para que a troca seja||&7bem-sucedida.||"
  162. slot 52 of player's current inventory is a green wool block
  163. loop all players:
  164. {var::%player%::trocad} is {var::%loop-player%::trocad}
  165. set {_value} to uncolored name of slot 37 of loop-player's current inventory
  166. set {_value2} to uncolored name of slot 53 of loop-player's current inventory
  167. replace all "Saldo: R$" with "" in {_value}
  168. replace all "Saldo: R$" with "" in {_value2}
  169. if loop-player's balance >= {_value} parsed as number:
  170. set {_m::%loop-player%} to {_value2} parsed as number
  171. set {_me::%loop-player%} to {_value} parsed as number
  172. else:
  173. set {_f} to "%loop-player%-%{_value}%"
  174. add loop-player to {_p::*}
  175. loop {_p::*}:
  176. if {_f} is set:
  177. send "&cA troca foi cancelada pois %{_f}% não havia dinheiro o suficiente." to loop-value
  178. else:
  179. add {_m::%loop-value%} to loop-value's balance
  180. remove {_me::%loop-value%} from loop-value's balance
  181. loop {_numbers::*}:
  182. set {_e} to loop-value-2 parsed as number + 5
  183. give slot {_e} of loop-value-1's current inventory to loop-value-1's inventory
  184. send "&aTroca finalizada com sucesso." to loop-value
  185.  
  186. delete {var::%loop-value%::troca}
  187. delete {troca::%loop-value%::*}
  188. delete {var::%loop-value%::trocad}
  189. close loop-value's inventory
  190.  
  191. loop all players:
  192. loop-player is not player
  193. {var::%player%::trocad} is {var::%loop-player%::trocad}
  194. if {_item} is set:
  195. set slot 52 of loop-player's current inventory to {_item}
  196. if {_d} is set:
  197. set name of slot 53 of loop-player's current inventory to "&eSaldo: &6R$%{_d}%"
  198. set name of slot 37 of player's current inventory to "&eSaldo: &6R$%{_d}%"
  199.  
  200. on rightclick on player:
  201. {@ShiftTroca} is true
  202. player is sneaking
  203. make player execute command "trade %event-entity%"
  204.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement