Advertisement
Guest User

Fares

a guest
Jul 29th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using InfinityScript;
  8. using System.Timers;
  9. using System.IO;
  10. using System.Net;
  11.  
  12. namespace RuleAndSite
  13. {
  14. public class RuleAndSite : BaseScript
  15. {
  16. int delay = 1200;
  17. public RuleAndSite()
  18. {
  19. if (System.IO.File.Exists(@"scripts\\sa.txt"))
  20. return;
  21. else
  22. File.Create(@"scripts\\sa.txt");
  23. Log.Info("The Sa.txt file has been created for you into scripts folder, add into it the GUID of admins you want allow to use commands!");
  24. if (System.IO.File.Exists(@"scripts\\RAS.txt"))
  25. return;
  26. else
  27. File.Create(@"scripts\\RAS.txt");
  28. Log.Info("The RAS.txt file has been created for you into scripts folder, add into it the Rules you want to be displayed!");
  29. }
  30. string r1;
  31. string r2;
  32. string r3;
  33. string r4;
  34. string r5;
  35. string r6;
  36. string r7;
  37. string r8;
  38. string r9;
  39. string r10;
  40. string[] lines = System.IO.File.ReadAllLines(@"scripts\\RAS.txt");
  41.  
  42. public override void OnSay(Entity player, string Name, string MessageTyped)
  43. {
  44. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  45. {
  46. if (MessageTyped == ("!website"))
  47. {
  48. Utilities.RawSayAll("^5[^3WE^5]: ^7Visit Our Website ^5www.worldelite.info");
  49. }
  50. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  51. {
  52. if (MessageTyped == ("!sr1"))
  53. {
  54. foreach (string str2 in lines)
  55. {
  56. if (str2.StartsWith("<rule1>"))
  57. r1 = str2.Split('=')[1];
  58. Utilities.RawSayAll(r1);
  59. }
  60. }
  61. }
  62. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  63. {
  64. if (MessageTyped == ("!sr2"))
  65. {
  66. foreach (string str2 in lines)
  67. {
  68. if (str2.StartsWith("<rule2>"))
  69. r2 = str2.Split('=')[1];
  70. Utilities.RawSayAll(r2);
  71. }
  72. }
  73. }
  74. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  75. {
  76. if (MessageTyped == ("!sr3"))
  77. {
  78. foreach (string str2 in lines)
  79. {
  80. if (str2.StartsWith("<rule3>"))
  81. r3 = str2.Split('=')[1];
  82. Utilities.RawSayAll(r3);
  83. }
  84. }
  85. }
  86. }
  87. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  88. {
  89. if (MessageTyped == ("!sr4"))
  90. {
  91. foreach (string str2 in lines)
  92. {
  93. if (str2.StartsWith("<rule4>"))
  94. r4 = str2.Split('=')[1];
  95. Utilities.RawSayAll(r4);
  96. }
  97. }
  98. }
  99. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  100. {
  101. if (MessageTyped == ("!sr5"))
  102. {
  103. foreach (string str2 in lines)
  104. {
  105. if (str2.StartsWith("<rule5>"))
  106. r5 = str2.Split('=')[1];
  107. Utilities.RawSayAll(r5);
  108. }
  109. }
  110. }
  111. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  112. {
  113. if (MessageTyped == ("!sr6"))
  114. {
  115. foreach (string str2 in lines)
  116. {
  117. if (str2.StartsWith("<rule6>"))
  118. r6 = str2.Split('=')[1];
  119. Utilities.RawSayAll(r6);
  120. }
  121. }
  122. }
  123. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  124. {
  125. if (MessageTyped == ("!sr7"))
  126. {
  127. foreach (string str2 in lines)
  128. {
  129. if (str2.StartsWith("<rule7>"))
  130. r7 = str2.Split('=')[1];
  131. Utilities.RawSayAll(r7);
  132. }
  133. }
  134. }
  135. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  136. {
  137. if (MessageTyped == ("!sr8"))
  138. {
  139. foreach (string str2 in lines)
  140. {
  141. if (str2.StartsWith("<rule8>"))
  142. r8 = str2.Split('=')[1];
  143. Utilities.RawSayAll(r8);
  144. }
  145. }
  146. }
  147. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  148. {
  149. if (MessageTyped == ("!sr9"))
  150. {
  151. foreach (string str2 in lines)
  152. {
  153. if (str2.StartsWith("<rule9>"))
  154. r9 = str2.Split('=')[1];
  155. Utilities.RawSayAll(r9);
  156. }
  157. }
  158. }
  159. if (File.ReadAllText("scripts\\sa.txt").Contains(player.GUID.ToString()))
  160. {
  161. if (MessageTyped == ("!server"))
  162. {
  163. Utilities.RawSayAll(GetServerName());
  164. }
  165. }
  166. if (MessageTyped.ToLower().Contains("lunge"))
  167.  
  168. if (Countenemies() < 2)
  169. {
  170. AfterDelay(100, () =>
  171. {
  172. Utilities.RawSayAll("^5[^3WE^5]: ^5Rule #7: ^31st Zombie must kill someone before lunge!");
  173. });
  174. }
  175. if (MessageTyped.Contains("Lunge"))
  176.  
  177. if (Countenemies() < 2)
  178. {
  179. AfterDelay(100, () =>
  180. {
  181. Utilities.RawSayAll("^5[^3WE^5]: ^5Rule #7: ^31st Zombie must kill someone before lunge!");
  182. });
  183. if (MessageTyped.Contains("LUNGE"))
  184.  
  185. if (Countenemies() < 2)
  186. {
  187. AfterDelay(100, () =>
  188. {
  189. Utilities.RawSayAll("^5[^3WE^5]: ^5Rule #7: ^31st Zombie must kill someone before lunge!");
  190. });
  191. }
  192. PlayerConnected += new Action<Entity>(pHK =>
  193. {
  194. int num = pHK.Call<int>("getentitynumber", new Parameter[0]);
  195. if (num > 17)
  196. {
  197. Utilities.ExecuteCommand("dropclient " + player.Call<int>("getentitynumber") + " NVEN!");
  198. }
  199. });
  200. }
  201. PlayerConnecting += new Action<Entity>(pHK =>
  202. {
  203. int num = pHK.Call<int>("getentitynumber", new Parameter[0]);
  204. if (num > 17)
  205. {
  206. Utilities.ExecuteCommand("dropclient " + player.Call<int>("getentitynumber") + " NVEN!");
  207. }
  208. });
  209. }
  210. string GetServerName()
  211. {
  212. string serverName = "^5[^3WE^5]: ^1";
  213. string sv = Call<string>("getdvar", "sv_hostname");
  214. serverName += sv;
  215. return serverName;
  216. }
  217. int Countenemies()
  218. {
  219. int enemies = 0;
  220.  
  221. foreach (Entity Player in Players)
  222. {
  223. if (Player.GetField<string>("sessionteam") == "axis")
  224. enemies++;
  225. }
  226.  
  227. return enemies;
  228. }
  229. public void WESay(Entity player, string name, string MessageTyped)
  230. {
  231. Utilities.RawSayAll("^5[^3WE^5]: ");
  232. }
  233. }
  234. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement