akon1248

Infect Function PI Edition

Jun 2nd, 2020
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.59 KB | None | 0 0
  1. function infect(p: player):
  2. {_p} is online
  3. {_p} do not have scoreboard tag "zombie"
  4. add "zombie" to scoreboard tags of {_p}
  5. loop all players:
  6. scoreboard team "zombie" in scoreboard scoreboard of loop-player is set
  7. scoreboard do not have entry "%{_p}%" in the team scoreboard team "zombie" in scoreboard scoreboard of loop-player
  8. scoreboard add entry "%{_p}%" to team scoreboard team "zombie" in scoreboard scoreboard of loop-player
  9. sendZombiePacket(loop-player, {_p})
  10. function cure(p: player):
  11. {_p} is online
  12. {_p} has scoreboard tag "zombie"
  13. remove "zombie" from scoreboard tags of {_p}
  14. loop all players:
  15. scoreboard team "zombie" in scoreboard scoreboard of loop-player is set
  16. scoreboard has entry "%{_p}%" in the team scoreboard team "zombie" in scoreboard scoreboard of loop-player
  17. scoreboard remove entry "%{_p}%" from team scoreboard team "zombie" in scoreboard scoreboard of loop-player
  18. set {_uuid} to UUID of {_p}
  19. {datawatcher::%{_uuid}%} is set
  20. set {_packet::1} to new play_server_named_entity_spawn packet
  21. set int pnum 0 of {_packet::1} to id of {_p}
  22. set "UUID" pinfo 0 of {_packet::1} to {_uuid}
  23. set double pnum 0 of {_packet::1} to x-loc of {_p}
  24. set double pnum 1 of {_packet::1} to y-loc of {_p}
  25. set double pnum 2 of {_packet::1} to z-loc of {_p}
  26. set byte pnum 0 of {_packet::1} to floor(yaw of {_p}*256/360)
  27. set byte pnum 1 of {_packet::1} to floor(pitch of {_p}*256/360)
  28. set "DataWatcherModifier" pinfo 0 of {_packet::1} to {datawatcher::%{_uuid}%}
  29. set {_packet::2} to new play_server_entity_equipment packet
  30. set int pnum 0 of {_packet::2} to id of {_p}
  31. set "ItemSlots" penum 0 of {_packet::2} to "MAINHAND"
  32. if tool of {_p} is set:
  33. set {_mainhand} to tool of {_p}
  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 {_p}
  37. set "ItemSlots" penum 0 of {_packet::3} to "OFFHAND"
  38. if offhand tool of {_p} is set:
  39. set {_offhand} to offhand tool of {_p}
  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 {_p}
  43. set "ItemSlots" penum 0 of {_packet::4} to "FEET"
  44. if boots of {_p} is set:
  45. set {_feet} to boots of {_p}
  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 {_p}
  49. set "ItemSlots" penum 0 of {_packet::5} to "LEGS"
  50. if leggings of {_p} is set:
  51. set {_legs} to leggings of {_p}
  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 {_p}
  55. set "ItemSlots" penum 0 of {_packet::6} to "CHEST"
  56. if chestplate of {_p} is set:
  57. set {_chest} to chestplate of {_p}
  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 {_p}
  61. set "ItemSlots" penum 0 of {_packet::7} to "HEAD"
  62. if helmet of {_p} is set:
  63. set {_head} to helmet of {_p}
  64. set "ItemModifier" pinfo 0 of {_packet::7} to {_head}
  65. loop all players:
  66. loop-player is not {_p}
  67. loop 7 times:
  68. send loop-player packet {_packet::%loop-number%}
  69. function sendZombiePacket(p1: player, p2: player):
  70. {_p1} is not {_p2}
  71. set {_packet::1} to new play_server_spawn_entity_living packet
  72. set int pnum 0 of {_packet::1} to id of {_p2}
  73. set int pnum 1 of {_packet::1} to 54
  74. set double pnum 0 of {_packet::1} to x-loc of {_p2}
  75. set double pnum 1 of {_packet::1} to y-loc of {_p2}
  76. set double pnum 2 of {_packet::1} to z-loc of {_p2}
  77. set byte pnum 0 of {_packet::1} to floor(yaw of {_p2}*256/360)
  78. set byte pnum 1 of {_packet::1} to floor(pitch of {_p2}*256/360)
  79. set byte pnum 2 of {_packet::1} to floor(yaw of {_p2}*256/360)
  80. set int pnum 2 of {_packet::1} to x of velocity of {_p2}*8000
  81. set int pnum 3 of {_packet::1} to y of velocity of {_p2}*8000
  82. set int pnum 4 of {_packet::1} to z of velocity of {_p2}*8000
  83. set {_json::2} to "&2&l%{_p2}%"
  84. set {_json::3} to true
  85. set "DataWatcher" pjson 0 of {_packet::1} to json from listvar {_json::*}
  86. set {_packet::2} to new play_server_entity_equipment packet
  87. set int pnum 0 of {_packet::2} to id of {_p2}
  88. set "ItemSlots" penum 0 of {_packet::2} to "MAINHAND"
  89. if tool of {_p2} is set:
  90. set {_mainhand} to tool of {_p2}
  91. set "ItemModifier" pinfo 0 of {_packet::2} to {_mainhand}
  92. set {_packet::3} to new play_server_entity_equipment packet
  93. set int pnum 0 of {_packet::3} to id of {_p2}
  94. set "ItemSlots" penum 0 of {_packet::3} to "OFFHAND"
  95. if offhand tool of {_p2} is set:
  96. set {_offhand} to offhand tool of {_p2}
  97. set "ItemModifier" pinfo 0 of {_packet::2} to {_offhand}
  98. set {_packet::4} to new play_server_entity_equipment packet
  99. set int pnum 0 of {_packet::4} to id of {_p2}
  100. set "ItemSlots" penum 0 of {_packet::4} to "FEET"
  101. if boots of {_p2} is set:
  102. set {_feet} to boots of {_p2}
  103. set "ItemModifier" pinfo 0 of {_packet::4} to {_feet}
  104. set {_packet::5} to new play_server_entity_equipment packet
  105. set int pnum 0 of {_packet::5} to id of {_p2}
  106. set "ItemSlots" penum 0 of {_packet::5} to "LEGS"
  107. if leggings of {_p2} is set:
  108. set {_legs} to leggings of {_p2}
  109. set "ItemModifier" pinfo 0 of {_packet::5} to {_legs}
  110. set {_packet::6} to new play_server_entity_equipment packet
  111. set int pnum 0 of {_packet::6} to id of {_p2}
  112. set "ItemSlots" penum 0 of {_packet::6} to "CHEST"
  113. if chestplate of {_p2} is set:
  114. set {_chest} to chestplate of {_p2}
  115. set "ItemModifier" pinfo 0 of {_packet::6} to {_chest}
  116. set {_packet::7} to new play_server_entity_equipment packet
  117. set int pnum 0 of {_packet::7} to id of {_p2}
  118. set "ItemSlots" penum 0 of {_packet::7} to "HEAD"
  119. if helmet of {_p2} is set:
  120. set {_head} to helmet of {_p2}
  121. set "ItemModifier" pinfo 0 of {_packet::7} to {_head}
  122. loop 7 times:
  123. send {_p1} packet {_packet::%loop-number%}
  124. on packet event play_server_entity_equipment:
  125. player's world pentity 0 of event-packet is a player
  126. "ItemSlots" penum 0 of event-packet is "MAINHAND" or "OFFHAND"
  127. if "ItemSlots" penum 0 of event-packet is "MAINHAND":
  128. "ItemModifier" pinfo 0 of event-packet is not tool of player's world pentity 0 of event-packet
  129. set {_item} to tool of player's world pentity 0 of event-packet
  130. else if "ItemSlots" penum 0 of event-packet is "OFFHAND":
  131. "ItemModifier" pinfo 0 of event-packet is not offhand tool of player's world pentity 0 of event-packet
  132. set {_item} to offhand tool of player's world pentity 0 of event-packet
  133. {_item} is set
  134. set "ItemModifier" pinfo 0 of event-packet to {_item}
  135. on packet event play_server_named_entity_spawn:
  136. player's world pentity 0 of event-packet is a player
  137. set {datawatcher::%UUID of player's world pentity 0 of event-packet%} to "DataWatcherModifier" pinfo 0 of event-packet
  138. player's world pentity 0 of event-packet has scoreboard tag "zombie"
  139. cancel event
  140. wait 1 tick
  141. sendZombiePacket(player, player's world pentity 0 of event-packet)
  142. on join:
  143. register new scoreboard team "zombie" in scoreboard scoreboard of player if scoreboard team "zombie" in scoreboard scoreboard of player is not set
  144. set {_team} to scoreboard team "zombie" in scoreboard scoreboard of player
  145. set scoreboard team prefix of {_team} to "&2&l"
  146. loop all players:
  147. loop-player has scoreboard tag "zombie"
  148. scoreboard do not have entry "%loop-player%" in the team scoreboard team "zombie" in scoreboard scoreboard of player
  149. scoreboard add entry "%loop-player%" to team scoreboard team "zombie" in scoreboard scoreboard of player
  150. player has scoreboard tag "zombie"
Advertisement
Add Comment
Please, Sign In to add comment