Guest User

My own custom script for Plutonium Black Ops II: Zombies

a guest
Dec 16th, 2021
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1. /*
  2. Combined GSC Script - Cryozyme
  3. Includes{
  4. Zombies Counter
  5. Give Points Command
  6. }
  7. */
  8.  
  9. //START IMPORTS
  10. #include maps\mp\_utility;
  11. #include common_scripts\utility;
  12. #include maps\mp\gametypes_zm\_hud_util;
  13. #include maps\mp\gametypes_zm\_hud_message;
  14. //END IMPORTS
  15.  
  16. //START MAIN FUNCTION
  17. main() {
  18. level thread onPlayerConnect(); //function that executes subfunctions when / if players connect, runs on a thread
  19. }
  20. //END IMPORTS
  21.  
  22. //START PLAYER-BOUND FUNCTIONS
  23. onPlayerConnect() {
  24. for(;;) {
  25. level waittill("connected", player); //wait until players connect to execute subfunctions
  26. player thread onPlayerMessage(); //reads the chat on a thread
  27. player thread drawZombiesCounter(); //calls zombies counter function on a thread
  28. }
  29. }
  30. //END PLAYER-BOUND FUNCTIONS
  31.  
  32. //START CHAT-BOUND FUNCTIONS
  33. onPlayerMessage() {
  34. self endon("disconnect");
  35. level endon("game_ended");
  36. //start give points chat command variables
  37. messageSize = message_strings.size;
  38. levelSize = level.players.size;
  39. giveCommand = "/give";
  40. //end give points chat command variables
  41. for(;;) {
  42. level waittill("say", player, message); //waits until a chat message is sent to execute subcommands
  43. //start give points chat function
  44. levelSize = level.players.size;
  45. for(i = 0; i < levelSize; i++) {
  46. message_strings = strToK(message, " ");
  47. if(tolower(message_strings[0]) == giveCommand && isSubStr(
  48. tolower(getPlayerName(level.players[i])), message_strings[1]
  49. )) {
  50. pointsValue = int(message_strings[(messageSize - 1)]);
  51. if(pointsValue < 0) {
  52. pointsValue = (pointsValue * -1);
  53. }
  54. player givePoints(level.players[i], int(pointsValue));
  55. }
  56. }
  57. //end give points chat function
  58. }
  59. }
  60. //END CHAT-BOUND FUNCTIONS
  61.  
  62. //START GIVE POINTS: GET PLAYER NAME SUBFUNCTION
  63. getPlayerName(player) {
  64. playerName = getSubStr(player.name, 0, player.name.size);
  65. for(i = 0; i < playerName.size; i++) {
  66. if(playerName[i] == "]") {
  67. break;
  68. }
  69. }
  70. if(playerName.size != i) {
  71. playerName = getSubStr(playerName, i + 1, playerName.size);
  72. }
  73. return playerName;
  74. }
  75. //END GIVE POINTS: GET PLAYER NAME SUBFUNCTION
  76.  
  77. //START GIVE POINTS FUNCTION
  78. givePoints(player, pointsValue) {
  79. //start give points command variables
  80. playerName = getPlayerName(player);
  81. yourName = getPlayerName(self);
  82. zmScore = maps\mp\zombies\_zm_score;
  83. pScore = player.score;
  84. sScore = self.score;
  85. //end give points command variables
  86. if(!isDefined(self.giving_points)) {
  87. self.giving_points = true;
  88. if(pScore == 1000000) {
  89. self tell(playerName + " already has ^51000000 ^7points.");
  90. } else if(sScore >= pointsValue) {
  91. self zmScore::minus_to_player_score(pointsValue, 1);
  92. self tell("^1Gave ^7" + yourName + " ^1" + pointsValue + "^7points!");
  93. player zmScore::add_to_player_score(pointsValue, 1);
  94. player tell("^2" + yourName + " ^7gave you ^2" + pointsValue + " ^7points!");
  95. } else {
  96. self tell("^1 You don't have enough points for that.");
  97. }
  98. wait 1;
  99. self.giving_points = undefined;
  100. }
  101. }
  102. //END GIVE POINTS FUNCTION
  103.  
  104. //START ZOMBIE COUNTER
  105. drawZombiesCounter() {
  106. self endon("disconnect");
  107. level endon("end_game");
  108. level waittill("start_of_round");
  109. hudUtility = maps\mp\gametypes_zm\_hud_util;
  110. zmUtility = maps\mp\zombies\_zm_utility;
  111. zmCounter = hudUtility::createFontString("hudsmall", 1.9);
  112. zmCounter.alpha = 0;
  113. zombieTotal = zmUtility::get_round_enemy_array().size + level.zombie_total;
  114. zmCounter hudUtility::setPoint("CENTER", "CENTER", "CENTER", 190);
  115. while(true) {
  116. zmCounter setValue(zombieTotal);
  117. if(zombieTotal != 0) {
  118. zmCounter.label = &"Zombies: ^1";
  119. if(zmCounter.alpha != 1) {
  120. zmCounter fadeovertime(0.5);
  121. zmCounter.alpha = 1;
  122. }
  123. } else {
  124. zmCounter.label = &"Zombies: ^6";
  125. for(i=0; i < 15; i++) {
  126. if(zmCounter.alpha == 1) {
  127. zmCounter fadeovertime(0.5);
  128. zmCounter.alpha = 0;
  129. } else {
  130. zmCounter fadeovertime(0.5);
  131. zmCounter.alpha = 1;
  132. }
  133. wait 0.5;
  134. }
  135. level waittill("start_of_round");
  136. }
  137. wait 0.05;
  138. }
  139. }
  140. //END ZOMBIE COUNTER
Advertisement
Add Comment
Please, Sign In to add comment