p2svox

medic_0.0.2

Sep 20th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.29 KB | None | 0 0
  1. OnFirstLoad()
  2. {
  3. VariableFloat.Set("radius", 50.0);
  4. VariableInt.Set("revTime", 10);
  5. VariableInt.Set("deathTime", 120);
  6. VariableInt.Set("cooldown", 300);
  7. }
  8. OnRoundStart()
  9. {
  10. VariableInt.Set("counterMain", 0);
  11. }
  12. OnUpdate()
  13. {
  14. VariableInt.Set("counterPlayer", 0);
  15. VariablePlayer.Set("player", VariablePlayer("null"));
  16. ForeachPlayer("player")
  17. {
  18. VariableString.Concat("xDir","x",VariableInt("counterPlayer").ConvertToString());
  19. VariableString.Concat("yDir","y",VariableInt("counterPlayer").ConvertToString());
  20. VariableString.Concat("zDir","z",VariableInt("counterPlayer").ConvertToString());
  21. VariableString.Concat("revDir","rev",VariableInt("counterPlayer").ConvertToString());
  22. VariableString.Concat("deathDir","death",VariableInt("counterPlayer").ConvertToString());
  23. VariableString.Concat("cooldownDir","cooldown",VariableInt("counterPlayer").ConvertToString());
  24. If(Bool.Equals(VariablePlayer("player").GetIsAlive(), true))
  25. {
  26. VariableFloat.Set("x", VariablePlayer("player").GetPositionX());
  27. VariableFloat.Set("y", VariablePlayer("player").GetPositionY());
  28. VariableFloat.Set("z", VariablePlayer("player").GetPositionZ());
  29. VariableFloat.Set(VariableString("xDir"), VariableFloat("x"));
  30. VariableFloat.Set(VariableString("yDir"), VariableFloat("y"));
  31. VariableFloat.Set(VariableString("zDir"), VariableFloat("z"));
  32. VariableInt.Set(VariableString("revDir"), 0);
  33. VariableInt.Set(VariableString("deathDir"), 0);
  34. }
  35. If(Bool.Equals(VariablePlayer("player").GetIsAlive(), false))
  36. {
  37. If(Int.LessThan(VariableInt(VariableString("deathDir")), VariableInt("deathTime")))
  38. {
  39. VariablePlayer.Set("playerMedic", VariablePlayer("null"));
  40. ForeachPlayer("playerMedic")
  41. {
  42. If(Player.NotEquals(VariablePlayer("player"), VariablePlayer("playerMedic")))
  43. {
  44. If(String.Equals(VariablePlayer("playerMedic").GetGuildName(), "[ffffff][ffffff]Medic"))
  45. {
  46. If(Bool.Equals(VariablePlayer("playerMedic").GetIsAlive(), true))
  47. {
  48. VariableFloat.Set("xgreater", VariableFloat(VariableString("xDir")));
  49. VariableFloat.Add("xgreater", VariableFloat("radius"));
  50. If(Float.LessThan(VariablePlayer("playerMedic").GetPositionX(), VariableFloat("xgreater")))
  51. {
  52. VariableFloat.Set("xless", VariableFloat(VariableString("xDir")));
  53. VariableFloat.Subtract("xless", VariableFloat("radius"));
  54. If(Float.GreaterThan(VariablePlayer("playerMedic").GetPositionX(), VariableFloat("xless")))
  55. {
  56. VariableFloat.Set("zgreater", VariableFloat(VariableString("zDir")));
  57. VariableFloat.Add("zgreater", VariableFloat("radius"));
  58. If(Float.LessThan(VariablePlayer("playerMedic").GetPositionZ(), VariableFloat("zgreater")))
  59. {
  60. VariableFloat.Set("zless", VariableFloat(VariableString("zDir")));
  61. VariableFloat.Subtract("zless", VariableFloat("radius"));
  62. If(Float.GreaterThan(VariablePlayer("playerMedic").GetPositionZ(), VariableFloat("zless")))
  63. {
  64. VariableInt.Add(VariableString("revDir"), 1);
  65. If(Int.Equals(VariableInt(VariableString("revDir")), 1))
  66. {
  67. VariableString.Concat("reviveWho", "<size=10>reviving</size><size=1>___</size><size=10>player</size><size=1>___</size><size=10>wait</size><size=1>___</size>","<size=15><color=#ff0000>", VariableInt("revTime").ConvertToString(),"</color></size>", "<size=1>___</size><size=10>seconds</size>");
  68. Game.PrintMessage(VariableString("reviveWho"));
  69. }
  70. If(Int.GreaterThanOrEqual(VariableInt(VariableString("revDir")), VariableInt("revTime")))
  71. {
  72. Player.SpawnPlayerAt(VariablePlayer("player"), VariablePlayer("playerMedic").GetPositionX(), VariablePlayer("playerMedic").GetPositionY(), VariablePlayer("playerMedic").GetPositionZ());
  73. VariableInt.Set(VariableString("revDir"), 0);
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. }
  84. If(Int.Equals(VariableInt(VariableString("deathDir")), VariableInt("deathTime")))
  85. {
  86. Game.PrintMessage("<size=10>a</size><size=1>___</size><size=10>soldier</size><size=1>___</size><size=10>has</size><size=1>___</size><size=10>been</size><size=1>___</size><size=10>lost</size>")
  87. }
  88. VariableInt.Add(VariableString("deathDir"), 1);
  89. }
  90. VariableInt.Add("counterPlayer", 1);
  91. }
  92. VariableInt.Add("counterMain", 1);
  93. }
  94. OnChatInput("chatInput")
  95. {
  96. If(String.StartsWith(VariableString("chatInput"), "/medic"))
  97. {
  98. VariableString.Remove("chatInput", "/medic");
  99. VariablePlayer.Set("player", VariablePlayer("null"));
  100. ForeachPlayer("player")
  101. {
  102. VariableBool.Set("passNotMedic", false);
  103. If(String.Contains(VariablePlayer("player").GetName(), VariableString("chatInput")))
  104. {
  105. If(String.NotEquals(VariablePlayer("player").GetGuildName(), "[ffffff][ffffff]Medic"))
  106. {
  107. Player.SetGuildName(VariablePlayer("player"), "[ffffff][ffffff]Medic");
  108. VariableString.Concat("AM", VariableString("chatInput"), "_is_now_medic");
  109. Game.PrintMessage(VariableString("AM"));
  110. VariableBool.Set("passNotMedic", true);
  111. }
  112. If(Bool.Equals(VariableBool("passNotMedic"), false))
  113. {
  114. If(String.Equals(VariablePlayer("player").GetGuildName(), "[ffffff][ffffff]Medic"))
  115. {
  116. Player.SetGuildName(VariablePlayer("player"), "");
  117. VariableString.Concat("ANM", VariableString("chatInput"), "_is_not_medic");
  118. Game.PrintMessage(VariableString("ANM"));
  119. }
  120. }
  121. }
  122. }
  123. }
  124. If(String.StartsWith(VariableString("chatInput"), "/revtime"))
  125. {
  126. VariableString.Remove("chatInput", "/revtime");
  127. VariableInt.Set("revTime", VariableString("chatInput").ConvertToInt());
  128. VariableString.Concat("revTimeWhat", "<size=10>revive</size><size=1>___</size><size=10>time</size><size=1>___</size><size=10>is</size><size=1>___</size>","<size=12><color=#ff4444>", VariableInt("revTime").ConvertToString(),"</color></size>", "<size=1>___</size><size=10>seconds</size>");
  129. Game.PrintMessage(VariableString("revTimeWhat"));
  130. }
  131. If(String.StartsWith(VariableString("chatInput"), "/revradius"))
  132. {
  133. VariableString.Remove("chatInput", "/revradius");
  134. VariableInt.Set("radius", VariableString("chatInput").ConvertToInt());
  135. VariableString.Concat("radiusWhat", "<size=10>revive</size><size=1>___</size><size=10>radius</size><size=1>___</size><size=10>is</size><size=1>___</size>","<size=12><color=#ff4444>", VariableInt("radius").ConvertToString(),"</color></size>", "<size=1>___</size><size=10>meters</size>");
  136. Game.PrintMessage(VariableString("radiusWhat"));
  137. }
  138. If(String.StartsWith(VariableString("chatInput"), "/deathtime"))
  139. {
  140. VariableString.Remove("chatInput", "/deathtime");
  141. VariableInt.Set("deathTime", VariableString("chatInput").ConvertToInt());
  142. VariableString.Concat("deathWhat", "<size=10>death</size><size=1>___</size><size=10>time</size><size=1>___</size><size=10>is</size><size=1>___</size>","<size=12><color=#ff4444>", VariableInt("deathTime").ConvertToString(),"</color></size>", "<size=1>___</size><size=10>seconds</size>");
  143. Game.PrintMessage(VariableString("deathWhat"));
  144. }
  145. If(String.StartsWith(VariableString("chatInput"), "/cooldown"))
  146. {
  147. VariableString.Remove("chatInput", "/cooldown");
  148. VariableInt.Set("cooldown", VariableString("chatInput").ConvertToInt());
  149. VariableString.Concat("cooldownWhat", "<size=10>cooldown</size><size=1>___</size><size=10>time</size><size=1>___</size><size=10>is</size><size=1>___</size>","<size=12><color=#ff4444>", VariableInt("cooldown").ConvertToString(),"</color></size>", "<size=1>___</size><size=10>seconds</size>");
  150. Game.PrintMessage(VariableString("cooldownWhat"));
  151. }
  152. }
Advertisement
Add Comment
Please, Sign In to add comment