akon1248

Untitled

Jul 4th, 2019
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.92 KB | None | 0 0
  1. variables:
  2. {infectchance} = 10
  3. command /infectchance [<text>]:
  4. permission: zombie.admin
  5. permission message: &cYou do not have permission to use this command.
  6. trigger:
  7. set {_chance} to arg parsed as number
  8. if {_chance} is not set:
  9. send "&c使用法: /infectchance <数値>"
  10. else:
  11. set {infectchance} to {_chance} > 100 ? 100 : {_chance}
  12. function sendZombiePacket(p1: player, p2: player):
  13. {_p1} is not {_p2}
  14. set {_packet::1} to new play_server_spawn_entity_living packet
  15. set int pnum 0 of {_packet::1} to id of {_p2}
  16. set int pnum 1 of {_packet::1} to 54
  17. set double pnum 0 of {_packet::1} to x-coordinate of {_p2}
  18. set double pnum 1 of {_packet::1} to y-coordinate of {_p2}
  19. set double pnum 2 of {_packet::1} to z-coordinate of {_p2}
  20. set byte pnum 0 of {_packet::1} to floor(yaw of {_p2}*256/360)
  21. set byte pnum 1 of {_packet::1} to floor(pitch of {_p2}*256/360)
  22. set byte pnum 2 of {_packet::1} to floor(yaw of {_p2}*256/360)
  23. set int pnum 2 of {_packet::1} to x of velocity of {_p2}*8000
  24. set int pnum 3 of {_packet::1} to y of velocity of {_p2}*8000
  25. set int pnum 4 of {_packet::1} to z of velocity of {_p2}*8000
  26. set {_json::2} to "&2&l%{_p2}%"
  27. set {_json::3} to true
  28. set "DataWatcher" pjson 0 of {_packet::1} to json from listvar {_json::*}
  29. set {_packet::2} to new play_server_entity_equipment packet
  30. set int pnum 0 of {_packet::2} to id of {_p2}
  31. set "ItemSlots" penum 0 of {_packet::2} to "MAINHAND"
  32. if tool of {_p2} is set:
  33. set {_mainhand} to tool of {_p2}
  34. set "ItemModifier" pinfo 0 of {_packet::2} to {_mainhand}
  35. set {_packet::3} to new play_server_entity_equipment packet
  36. set int pnum 0 of {_packet::3} to id of {_p2}
  37. set "ItemSlots" penum 0 of {_packet::3} to "OFFHAND"
  38. if offhand tool of {_p2} is set:
  39. set {_offhand} to offhand tool of {_p2}
  40. set "ItemModifier" pinfo 0 of {_packet::2} to {_offhand}
  41. set {_packet::4} to new play_server_entity_equipment packet
  42. set int pnum 0 of {_packet::4} to id of {_p2}
  43. set "ItemSlots" penum 0 of {_packet::4} to "FEET"
  44. if boots of {_p2} is set:
  45. set {_feet} to boots of {_p2}
  46. set "ItemModifier" pinfo 0 of {_packet::4} to {_feet}
  47. set {_packet::5} to new play_server_entity_equipment packet
  48. set int pnum 0 of {_packet::5} to id of {_p2}
  49. set "ItemSlots" penum 0 of {_packet::5} to "LEGS"
  50. if leggings of {_p2} is set:
  51. set {_legs} to leggings of {_p2}
  52. set "ItemModifier" pinfo 0 of {_packet::5} to {_legs}
  53. set {_packet::6} to new play_server_entity_equipment packet
  54. set int pnum 0 of {_packet::6} to id of {_p2}
  55. set "ItemSlots" penum 0 of {_packet::6} to "CHEST"
  56. if chestplate of {_p2} is set:
  57. set {_chest} to chestplate of {_p2}
  58. set "ItemModifier" pinfo 0 of {_packet::6} to {_chest}
  59. set {_packet::7} to new play_server_entity_equipment packet
  60. set int pnum 0 of {_packet::7} to id of {_p2}
  61. set "ItemSlots" penum 0 of {_packet::7} to "HEAD"
  62. if helmet of {_p2} is set:
  63. set {_head} to helmet of {_p2}
  64. set "ItemModifier" pinfo 0 of {_packet::7} to {_head}
  65. loop 7 times:
  66. send {_p1} packet {_packet::%loop-number%}
  67. on packet event play_server_entity_equipment:
  68. player's world pentity 0 of event-packet is a player
  69. "ItemSlots" penum 0 of event-packet is "MAINHAND" or "OFFHAND"
  70. if "ItemSlots" penum 0 of event-packet is "MAINHAND":
  71. "ItemModifier" pinfo 0 of event-packet is not tool of player's world pentity 0 of event-packet
  72. set {_item} to tool of player's world pentity 0 of event-packet
  73. else if "ItemSlots" penum 0 of event-packet is "OFFHAND":
  74. "ItemModifier" pinfo 0 of event-packet is not offhand tool of player's world pentity 0 of event-packet
  75. set {_item} to offhand tool of player's world pentity 0 of event-packet
  76. {_item} is set
  77. set "ItemModifier" pinfo 0 of event-packet to {_item}
  78. on death of player:
  79. victim has scoreboard tag "zombie"
  80. remove "zombie" from scoreboard tags of victim
  81. reset victim's displayed skin
  82. on damage of player:
  83. victim do not have scoreboard tag "zombie"
  84. tag "Health" of nbt of victim <= final damage
  85. check [attacker is a zombie] or check [check [attacker is a player] and check [attacker has scoreboard tag "zombie"]]
  86. chance of {infectchance}%
  87. cancel event
  88. remove all potion effects from victim
  89. heal victim
  90. set food of victim to 10
  91. add "zombie" to scoreboard tags of victim
  92. broadcast "&2&l%victim%&aはゾンビになってしまった!"
  93. set victim's displayed skin to skin with value "eyJ0aW1lc3RhbXAiOjE1NDQ0NTk4Mzc4MjMsInByb2ZpbGVJZCI6IjQzYTgzNzNkNjQyOTQ1MTBhOWFhYjMwZjViM2NlYmIzIiwicHJvZmlsZU5hbWUiOiJTa3VsbENsaWVudFNraW42Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDY3NTUzYjMxOGJhMmVlMmI2MjZlOWI5ZGVkM2UxNWExZDBkOGQ5ZjM3MGZmMDNjOThiMzIzZTc4NTczYjlhIn19fQ==" signature "yUVWH96rIrYzOO4fCeB30pPSsdyaMJHwP0jKPfd+cfp5Bk5uOd5g547ISckhU0bZMWAkKqEeXUY3R1hsW3GJl+OKdTQwkKVhSdWf6AEV0LaTPav8TCd5jF2JVWDlGeXgHTp+TdBZPJIdWT1uuLuY42YdTfMGsywFE0rGljRo97hpMvBhgRcakw6d4friHUfzJy9shVeXW4gF8xZg79DP+WZ32F/IrsgoRU5O2nxM9ZgmjyaLTyO9WKQoMEpcLJl8vAet2NjJ1YH6klOxnqZpjYPebQuyfFb/ZfTfJv+AevccDCqr1T7OEM2u3MTwttcov5KbnhawrHZnVIBio2sTQGFUmzcsmIJht04YWGkQlrvSzQ4+6/Qyzixl4PE3pfbwg3truuJgItstLLbnNKFqa3H/RQam18vKdM8u7lqOomP4fWP4VEhBcIElnfwohy0PRJ+KOA5586WupKD3bxiAViUN4ywj212gyG6ie8KDDfrtC+e3VOWi/Vja+bJEmy2oHUndesySAZhNNMhrRIOYAARrhpcR0Cl8TmTVCYC4ooaKTdowi8cELLBxCnCJElozKUv2jhoWrpL4ZCSAepz85NdiQk2NjSNqgUOKzxf/pLD4iPs9R0+bVipyN8eGTpSzDdAQ4xO8n2nPQbcqfzqlIfY5hPF0S0+gApK68VXBGkA="
  94. play sound "entity.zombie.infect" to all players at attacker with volume 1 pitch 1
  95. loop all entities:
  96. if loop-entity is a player:
  97. sendZombiePacket(loop-entity, victim)
  98. else:
  99. target of loop-entity is victim
  100. delete target of loop-entity
  101. on packet event play_server_named_entity_spawn:
  102. player's world pentity 0 of event-packet is a player
  103. player's world pentity 0 of event-packet has scoreboard tag "zombie"
  104. wait 1 tick
  105. sendZombiePacket(player, player's world pentity 0 of event-packet)
  106. on join:
  107. player has scoreboard tag "zombie"
  108. set player's displayed skin to skin with value "eyJ0aW1lc3RhbXAiOjE1NDQ0NTk4Mzc4MjMsInByb2ZpbGVJZCI6IjQzYTgzNzNkNjQyOTQ1MTBhOWFhYjMwZjViM2NlYmIzIiwicHJvZmlsZU5hbWUiOiJTa3VsbENsaWVudFNraW42Iiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDY3NTUzYjMxOGJhMmVlMmI2MjZlOWI5ZGVkM2UxNWExZDBkOGQ5ZjM3MGZmMDNjOThiMzIzZTc4NTczYjlhIn19fQ==" signature "yUVWH96rIrYzOO4fCeB30pPSsdyaMJHwP0jKPfd+cfp5Bk5uOd5g547ISckhU0bZMWAkKqEeXUY3R1hsW3GJl+OKdTQwkKVhSdWf6AEV0LaTPav8TCd5jF2JVWDlGeXgHTp+TdBZPJIdWT1uuLuY42YdTfMGsywFE0rGljRo97hpMvBhgRcakw6d4friHUfzJy9shVeXW4gF8xZg79DP+WZ32F/IrsgoRU5O2nxM9ZgmjyaLTyO9WKQoMEpcLJl8vAet2NjJ1YH6klOxnqZpjYPebQuyfFb/ZfTfJv+AevccDCqr1T7OEM2u3MTwttcov5KbnhawrHZnVIBio2sTQGFUmzcsmIJht04YWGkQlrvSzQ4+6/Qyzixl4PE3pfbwg3truuJgItstLLbnNKFqa3H/RQam18vKdM8u7lqOomP4fWP4VEhBcIElnfwohy0PRJ+KOA5586WupKD3bxiAViUN4ywj212gyG6ie8KDDfrtC+e3VOWi/Vja+bJEmy2oHUndesySAZhNNMhrRIOYAARrhpcR0Cl8TmTVCYC4ooaKTdowi8cELLBxCnCJElozKUv2jhoWrpL4ZCSAepz85NdiQk2NjSNqgUOKzxf/pLD4iPs9R0+bVipyN8eGTpSzDdAQ4xO8n2nPQbcqfzqlIfY5hPF0S0+gApK68VXBGkA="
  109. every second:
  110. loop all entities:
  111. type of loop-entity is snow golem or iron golem
  112. target of loop-entity is not set
  113. set {_short} to 31
  114. loop players in radius 30 around loop-entity:
  115. loop-player-1 has scoreboard tag "zombie"
  116. {_short} > distance between loop-entity-1 and loop-player-1
  117. set {_short} to distance between loop-entity-1 and loop-player-1
  118. set {_target} to loop-player-1
  119. delete {_short}
  120. set target of loop-entity to {_target}
  121. delete {_target}
  122. on target:
  123. target of event-entity has scoreboard tag "zombie"
  124. cancel event
  125. on damage:
  126. attacker is a player
  127. attacker's gamemode is survival or adventure
  128. if attacker has scoreboard tag "zombie":
  129. check [victim is a zombie] or check [check [victim is a player] and check [victim has scoreboard tag "zombie"]]
  130. cancel event
  131. else:
  132. check [victim is a player] and check [victim do not have scoreboard tag "zombie"]
  133. cancel event
Advertisement
Add Comment
Please, Sign In to add comment