Advertisement
Guest User

MBS vs MPHP Code Samples

a guest
Jun 19th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. MP Hax Package (referred to as "MPHP") vs Marble Blast Super (referred to as "MBS")
  2.  
  3. MPHP:
  4.  
  5. // Jeff: grab the client sided marble, very useful for clients to have
  6. // some control of the marble object
  7. function getMyMarble() {
  8. //No errors!
  9. if (!isObject(ServerConnection)) {
  10. return;
  11. }
  12.  
  13. for (%i = 0; %i < ServerConnection.getCount(); %i ++) {
  14. %obj = ServerConnection.getObject(%i);
  15. if (%obj.getClassName() $= "Marble") {
  16. //HiGuy: If you are not the host, your marble is always the second one
  17. $Game::MyMarble = %obj;
  18. return %obj;
  19. }
  20. }
  21. return -1;
  22. }
  23.  
  24.  
  25. MBS:
  26. function getMyMarble()
  27. {
  28. if (!isObject(ServerConnection))
  29. return;
  30.  
  31. if ($Multiplayer::MyMarble !$= "")
  32. return $Multiplayer::MyMarble;
  33.  
  34. for (%i = 0; %i < ServerConnection.getCount(); %i++)
  35. {
  36. %obj = ServerConnection.getObject(%i);
  37. if (%obj.getClassName() $= "Marble")
  38. {
  39. $Multiplayer::MyMarble = %obj;
  40. return %obj;
  41. }
  42. }
  43. }
  44.  
  45.  
  46. MPHP:
  47. //HiGuy: Hides other peoples' Marbles (caps because they are of the Marble class)
  48. function hideFreddies() {
  49. //No errors!
  50. if (!isObject(ServerConnection)) {
  51. return;
  52. }
  53.  
  54. //We need our marble to compare marbles
  55. if (!isObject($Game::MyMarble) && getMyMarble() == -1)
  56. return;
  57.  
  58. cancel($Game::HideFreddieSchedule);
  59.  
  60. //Iterate!
  61. for (%i = 0; %i < ServerConnection.getCount(); %i ++) {
  62. %obj = ServerConnection.getObject(%i);
  63.  
  64. //If it's a marble, and it's not us
  65. if (%obj.getClassName() $= "Marble" && %obj.getId() != $Game::MyMarble.getId()) {
  66. //Easy hiding, as we can't use .hide or the game will crash
  67. %obj.setScale("0 0 0");
  68. //Get them out of the way, we don't want shadows
  69. %obj.setTransform("0 0 -1000000 1 0 0 0");
  70. }
  71. }
  72.  
  73. $Game::HideFreddieSchedule = schedule($MP::Core::HideFreddieDelta, 0, hideFreddies);
  74. }
  75.  
  76. MBS:
  77.  
  78. function hideMarbles()
  79. {
  80. if (!isObject(ServerConnection))
  81. return;
  82.  
  83. if ($Multiplayer::MyMarble $= "")
  84. {
  85. getMyMarble();
  86. return;
  87. }
  88.  
  89. for (%i = 0; %i < ServerConnection.getCount(); %i++)
  90. {
  91. %obj = ServerConnection.getObject(%i);
  92. if (%obj.getClassName() $= "Marble" && %obj.getId() != $Multiplayer::MyMarble.getId())
  93. {
  94. %obj.setScale(0);
  95.  
  96. %obj.setTransform("0 0 -1000000 1 0 0 0");
  97. }
  98. }
  99. }
  100.  
  101. MPHP:
  102. //HiGuy: Actually hides the ghost
  103. function hideMyGhost() {
  104. //No errors!
  105. if (!isObject(ServerConnection)) {
  106. return;
  107. }
  108.  
  109. //We need our marble to compare scales
  110. if (!isObject($Game::MyMarble) && getMyMarble() == -1)
  111. return;
  112.  
  113. //Iterate!
  114. for (%i = 0; %i < ServerConnection.getCount(); %i ++) {
  115. %obj = ServerConnection.getObject(%i);
  116.  
  117. //If it's a ghost...
  118. if (%obj.getClassName() $= "StaticShape" && strStr(%obj.getDataBlock().shapeFile, "/balls/") != -1) {
  119. //If it has the same scale as our marble
  120. if (getWord(%obj.getScale(), 0) $= $Game::MyScale) {
  121. //BAD GHOST
  122. %obj.hide(true);
  123. break;
  124. }
  125. }
  126. }
  127. }
  128.  
  129. MBS:
  130. function getMyGhost()
  131. {
  132. if (!isObject(ServerConnection))
  133. return;
  134.  
  135. if ($Multiplayer::MyGhost !$= "")
  136. return $Multiplayer::MyGhost;
  137.  
  138. for (%i = 0; %i < ServerConnection.getCount(); %i++)
  139. {
  140. %obj = ServerConnection.getObject(%i);
  141. if (%obj.getClassName() $= "StaticShape" && strStr(%obj.getDatablock().shapeFile, "/balls/") != -1 && getWord(%obj.getScale(), 0) $= $Multiplayer::MyScale)
  142. {
  143. $Multiplayer::MyGhost = %obj;
  144. return %obj;
  145. }
  146. }
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement