LHemon412

pvpgame.sk

Aug 8th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. options:
  2. x: -568
  3. y: 64
  4. z: -9
  5. world: "miniwarpvpgame"
  6. prefix: &c競技場 >>
  7.  
  8.  
  9. on enable:
  10. set {pvpgame::loc} to location({@x}, {@y}, {@z}, world({@world}))
  11.  
  12. on disable:
  13. delete {pvpgame::loc}
  14. delete {pvpgame::waiting}
  15.  
  16. on quit:
  17. {pvpgame::waiting} is set
  18. {pvpgame::waiting} is player
  19. delete {pvpgame::waiting}
  20.  
  21. on join:
  22. if {pvpgame::%player%::joined} is set:
  23. send "{@prefix} &e由於決鬥過程中伺服器重啟,決鬥已經取消"
  24. send "{@prefix} &e物品已發還"
  25. loadinv(player)
  26. delete {pvpgame::%player%::joined}
  27.  
  28. function saveinv(p: player):
  29. set {_slot} to 0
  30. loop 36 times:
  31. set {pvpgame::%{_p}%::inv::%{_slot}%} to slot {_slot} of {_p}'s inventory
  32. add 1 to {_slot}
  33. set {pvpgame::%{_p}%::helmet} to {_p}'s helmet
  34. set {pvpgame::%{_p}%::chestplate} to {_p}'s chestplate
  35. set {pvpgame::%{_p}%::leggings} to {_p}'s leggings
  36. set {pvpgame::%{_p}%::boots} to {_p}'s boots
  37.  
  38. function loadinv(p: player):
  39. set {_slot} to 0
  40. loop 36 times:
  41. set slot {_slot} of {_p}'s inventory to {pvpgame::%{_p}%::inv::%{_slot}%}
  42. add 1 to {_slot}
  43. set {_p}'s helmet to {pvpgame::%{_p}%::helmet}
  44. set {_p}'s chestplate to {pvpgame::%{_p}%::chestplate}
  45. set {_p}'s leggings to {pvpgame::%{_p}%::leggings}
  46. set {_p}'s boots to {pvpgame::%{_p}%::boots}
  47.  
  48. command /pvp:
  49. trigger:
  50. if {pvpgame::%player%::joined} is set:
  51. send "{@prefix} &e你已經處於戰鬥中"
  52. stop
  53. if {pvpgame::used} is set:
  54. send "{@prefix} &e已經有玩家處於決鬥中,請稍候"
  55. stop
  56. if {pvpgame::waiting} is player:
  57. send "{@prefix} &e對決等待配對中..."
  58. stop
  59. if {pvpgame::waiting} is not set:
  60. set {pvpgame::waiting} to player
  61. send "{@prefix} &e對決等待配對中... 你可以邀請朋友輸入 /pvp 與你一起對決"
  62. stop
  63. else:
  64. #match begin
  65. set {_p1} to {pvpgame::waiting}
  66. delete {pvpgame::waiting}
  67. set {_p2} to player
  68. set {pvpgame::p1} to {_p1}
  69. set {pvpgame::p2} to {_p2}
  70. send "{@prefix} &e對決配對完畢! 即將在 3秒後傳送到競技場..." to {_p1}
  71. send "{@prefix} &e對決配對完畢! 即將在 3秒後傳送到競技場..." to {_p2}
  72. wait 3 seconds
  73.  
  74. saveinv({_p1})
  75. saveinv({_p2})
  76.  
  77. clear {_p1}'s inventory
  78. clear {_p2}'s inventory
  79.  
  80. set {_helmet} to iron helmet of protection 2
  81. set {_chestplate} to iron chestplate of protection 2
  82. set {_leggings} to iron leggings of protection 2
  83. set {_boots} to iron boots of protection 2
  84. set {_weapon} to iron sword of fire aspect 1
  85. set {_food} to 64 cooked fish
  86.  
  87. set {_p1}'s helmet to {_helmet}
  88. set {_p1}'s chestplate to {_chestplate}
  89. set {_p1}'s leggings to {_leggings}
  90. set {_p1}'s boots to {_boots}
  91. give {_p1} {_weapon}
  92. give {_p1} {_food}
  93.  
  94. set {_p2}'s helmet to {_helmet}
  95. set {_p2}'s chestplate to {_chestplate}
  96. set {_p2}'s leggings to {_leggings}
  97. set {_p2}'s boots to {_boots}
  98. give {_p2} {_weapon}
  99. give {_p2} {_food}
  100.  
  101. teleport {_p1} to {pvpgame::loc}
  102. teleport {_p2} to {pvpgame::loc}
  103. send "{@prefix} &e對決開始!" to {_p1}
  104. send "{@prefix} &e對決開始!" to {_p2}
  105. set {pvpgame::%{_p1}%::joined} to true
  106. set {pvpgame::%{_p2}%::joined} to true
  107.  
  108. on death:
  109. {pvpgame::%victim%::joined} is set
  110. #attacker is player
  111. set {_gg} to null
  112. if "%{pvpgame::p1}%" is "%victim%":
  113. set {_gg} to {pvpgame::p2}
  114. else:
  115. set {_gg} to {pvpgame::p1}
  116. give {_gg} 2 brick named "&6&l競技場積分" with lore "&e在競技場戰勝後取得的獎勵||&e可換取不同的獎勵"
  117.  
  118. set {_found} to false
  119. loop all items in victim's inventory:
  120. loop-item's name is "&6&l競技場積分"
  121. set {_found} to true
  122. if {_found} is true:
  123. remove 1 brick named "&6&l競技場積分" with lore "&e在競技場戰勝後取得的獎勵||&e可換取不同的獎勵" from player
  124. send "{@prefix} 由於戰敗,你被扣除了 1個競技場積分" to victim
  125. else:
  126. send "{@prefix} 由於戰敗,且你沒有任何積分,所以你沒有被扣除任何積分" to victim
  127. send "{@prefix} 你成功殺死對方了! 積分 &a&l+2" to {_gg}
  128. make victim execute command "/spawn"
  129. make {_gg} execute command "/spawn"
  130.  
  131. clear victim's inventory
  132. clear {_gg}'s inventory
  133.  
  134. loadinv({_gg})
  135. loadinv(victim)
  136. #remove 1 brick named "&6&l競技場積分" with lore "&e在競技場戰勝後取得的獎勵||&e可換取不同的獎勵" from player
  137. delete {pvpgame::%player%::joined}
  138. delete {pvpgame::%{_gg}%::joined}
  139.  
  140. on mor.inventory click:
  141. if name of event-item contains "競技場積分":
  142. if "%type of event-inventory%" is not "player inventory":
  143. cancel event
  144. send "&c你不可以對積分進行此類動作!" to event-player
  145. else if name of cursor item of player contains "競技場積分":
  146. if "%type of event-inventory%" is not "player inventory":
  147. cancel event
  148. send "&c你不可以對積分進行此類動作!" to event-player
  149. on drop:
  150. if name of event-item contains "競技場積分":
  151. cancel event
  152. send "&c你不可以對積分進行此類動作!" to event-player
Advertisement
Add Comment
Please, Sign In to add comment