Guest User

Untitled

a guest
Dec 18th, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.46 KB | None | 0 0
  1. //Rimon By Davidi12-LeTmE
  2.  
  3.  
  4. #include <a_samp>
  5. #pragma tabsize 0
  6. //====================================Defines===================================
  7. #define COLOR_RED 0xAA3333AA
  8. #define COLOR_WHITE 0xFFFFFFAA
  9. #define COLOR_LIGHTGREEN 0x24FF0AB9
  10. #define COLOR_PEACH 0xEECFA1AA //peach
  11. #define COLOR_YELLOW 0xFFFF00AA
  12. #define MinWarPlayers 1
  13. //=====================================News=====================================
  14. new RimonOn;
  15. new InRimon[MAX_PLAYERS];
  16. new RimonPlayers;
  17. new playername[MAX_PLAYER_NAME];
  18. new Count;
  19. new knoob;
  20. new CountFuc;
  21. new Reward;
  22. new knob[256];
  23. new RimonWinner;
  24. new CheckTime;
  25. new WS;
  26. new PP[MAX_PLAYERS];
  27. new RimonWeapons[] = {16};
  28. //=============================Random Rimon Spawns================================
  29. new Float:RandSpawn[] [] = {
  30. {-2564.538,1092.589,55.664,337.096},
  31. {-2356.0573,995.4032,50.8984,182.0485},
  32. {-1382.105224,-230.142044,14.148437,313.913299},
  33. {-2396.605468,-617.606628,132.737396,36.312511},
  34. {1867.630493,-1442.807006,13.540561,317.000457},
  35. {-2128.956298,925.477416,79.966804,93.446701},
  36. {2192.915283,1670.262939,12.367187,89.400100},
  37. {366.690490,2557.363281,16.856082,181.276748},
  38. {-2929.666992,453.267517,4.914062,270.580932},
  39. {-2422.023437,286.051605,35.257869,71.032470},
  40. {2495.416748,-1687.549682,13.516131,2.144218},
  41. {-1508.722045,1019.904846,7.187500,179.759155},
  42. {-1499.821166,715.792602,7.212387,89.336952},
  43. {-1619.134155,681.706298,7.190120,89.963623},
  44. {-1410.905273,456.152038,7.187500,1.245707},
  45. {-2408.289794,-2175.717285,33.289062,270.799926},
  46. {-1631.521606,-2239.001220,31.476562,91.180885},
  47. {-90.911148,-1159.593139,2.067930,58.911594},
  48. {-2246.060791,2284.073486,4.970916,359.469268},
  49. {-2543.482177,1216.352905,37.421875,3.426709},
  50. {-2650.885742,1361.723266,12.250000,179.712753},
  51. {-2841.463378,1301.068481,7.101562,181.569442},
  52. {-2899.006591,1063.880126,32.132812,266.714843},
  53. {-2758.178955,376.006683,4.333554,271.460571},
  54. {-2654.040527,206.110565,4.335937,0.469989},
  55. {-2026.803344,156.846771,29.039062,269.686340},
  56. {-1969.536743,159.899826,27.687500,180.095474},
  57. {-1959.827880,293.920349,35.468750,90.191314},
  58. {-2039.647705,-81.948585,35.320312,1.408744},
  59. {-1828.319213,108.475776,15.117187,264.632873},
  60. {-1710.443725,399.048828,7.187244,225.592437},
  61. {-1617.258666,1286.358520,7.184526,85.461174},
  62. {-2063.862304,1381.531005,7.100666,180.327468},
  63. {-2476.466308,1266.988769,28.159187,271.818572},
  64. {-2280.303710,1022.978637,83.932350,271.810791},
  65. {-2269.722900,535.506103,35.015625,268.893798},
  66. {-2212.083251,307.103424,35.117187,179.338928},
  67. {-2286.310546,150.778594,35.312500,270.636749},
  68. {-2656.270263,-278.185577,7.495392,43.365280},
  69. {-2721.727050,-317.288574,7.843750,45.895351},
  70. {708.769714,1926.467773,5.582498,358.166961},
  71. {-2540.925537,-596.941040,132.710937,268.919036},
  72. {-1995.975708,-859.088928,32.171875,94.306816},
  73. {-2136.151855,-388.964965,35.343013,359.299926},
  74. {-1421.252319,-514.835449,14.177608,203.312210},
  75. {-3102.738037,477.210845,35.113548,269.079071},
  76. {-2483.815429,1069.525390,55.766624,355.448913},
  77. {-2407.970703,722.858520,38.273437,91.772735},
  78. {-2445.706054,516.771789,30.108627,271.580230},
  79. {-2571.287597,556.769042,14.460937,359.057678},
  80. {-1658.594116,1207.322875,7.250000,19.374435},
  81. {-2660.122802,878.268493,79.773796,2.053548},
  82. {-2300.773437,1100.437500,79.993370,93.170181},
  83. {-2314.582031,1064.930664,65.585937,85.336761},
  84. {-2572.343017,1156.694091,63.390625,159.725082},
  85. {-2800.076416,1184.888183,20.273437,128.795059},
  86. {-2090.675537,2314.161621,25.914062,116.540672},
  87. {-2387.207519,2446.915283,10.169355,159.660369},
  88. {-2062.444824,1095.738037,55.614360,178.901611},
  89. {-1699.265380,1351.616210,7.179687,135.997940},
  90. {-2018.340576,952.518920,45.802761,269.142486},
  91. {-2304.288574,1544.356811,18.773437,90.848190},
  92. {-2646.972,1400.710,24.765,198.280},
  93. {}
  94. };
  95.  
  96.  
  97.  
  98. new Float:gRandomRimonSpawns[][3] = {
  99. {-1399.2046,962.3701,1025.0680}, //WarRandomSpawn 1
  100. {-1427.0304,937.4364,1036.5261}, //WarRandomSpawn 2
  101. {-1430.2296,976.9035,1023.9880}, //WarRandomSpawn 3
  102. {-1432.1825,1007.2070,1024.3608}, //WarRandomSpawn 4
  103. {-1427.3069,1025.1040,1025.7916}, //WarRandomSpawn 5
  104. {-1398.1837,1054.6473,1038.4374}, //WarRandomSpawn 6
  105. {-1372.7314,1040.5634,1029.5721}, //WarRandomSpawn 7
  106. {-1351.1743,1011.9717,1024.7466}, //WarRandomSpawn 8
  107. {-1344.1238,984.6110,1024.3459}, //WarRandomSpawn 9
  108. {-1329.5845,957.0134,1030.1298}, //WarRandomSpawn 10
  109. {-1343.9712,935.3727,1036.3542}, //WarRandomSpawn 11
  110. {-1309.3192,950.7583,1036.5508}, //WarRandomSpawn 12
  111. {-1372.2295,958.0103,1025.9514}, //WarRandomSpawn 13
  112. {-1398.3308,955.6279,1026.6305}, //WarRandomSpawn 14
  113. {-1421.1644,955.9434,1026.5865}, //WarRandomSpawn 15
  114. {-1460.7736,969.6113,1026.1754}, //WarRandomSpawn 16
  115. {-1470.2109,999.2858,1025.7461}, //WarRandomSpawn 17
  116. {-1443.2224,988.0159,1024.0590}, //WarRandomSpawn 18
  117. {-1434.0100,997.4805,1024.2064}, //WarRandomSpawn 19
  118. {-1422.4056,985.5712,1023.9828} };
  119.  
  120.  
  121. //===============================OnFilterScriptInit=============================
  122. public OnFilterScriptInit() {
  123. print(" Rimon By Davidi12-LeTmE ");
  124. print("--- ok ---");
  125. print(" ** Loaded ** ");
  126. AllowInteriorWeapons(1);
  127. return 1; }
  128. //==============================OnFilterScriptExit==============================
  129. public OnFilterScriptExit() {
  130. print(" --Rimon-- ");
  131. print(" --- Davidi12-LeTmE --- ");
  132. print(" ** Unloaded **");
  133. return 1; }
  134. //=============================OnPlayerCommandText==============================
  135. public OnPlayerCommandText(playerid, cmdtext[]) {
  136. new cmd[256];
  137. new idx;
  138. new tmp[256];
  139. cmd = strtok(cmdtext, idx);
  140.  
  141. new String[256];
  142. if(!strcmp(cmd, "/Kill", true)) return (playerid);
  143. format(String,sizeof(String),"{ffff00}/Kill ìà ðéúï ìáöò ô÷åãåú áæîï ôòéìåú, ìéöéàä ä÷ù/é");
  144. if(InRimon[playerid] == 1 && RimonOn == 1)return ShowPlayerDialog(playerid,11991,DIALOG_STYLE_MSGBOX,"{ffff00}Error",String,"äîùê","");
  145. //===============================WarStart Command===============================
  146. if(!strcmp(cmd, "/startRimon", true)) {
  147. tmp = strtok(cmdtext, idx);
  148. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WHITE, " äô÷åãä ìà ðîöàä áîòøëú");
  149. if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_LIGHTGREEN, " /Rimonstart [Reward] :ùéîåù ");
  150. if(RimonOn == 1) return SendClientMessage(playerid, COLOR_RED, " éù ëáø îìçîä ôòéìä ");
  151. Reward = strval(tmp);
  152. WarStart();
  153. return 1; }
  154. //===============================WarJoin Command================================
  155. if(!strcmp(cmd, "/rimon", true)) {
  156. if(RimonOn == 0) return SendClientMessage(playerid, COLOR_RED, " àéï òëùéå ôòéìåú");
  157. if(WS == 1) return SendClientMessage(playerid, COLOR_RED, " äôòéìåú ëáø äçìä,ðñä ôòí äáàä");
  158. if(RimonPlayers == sizeof(gRandomRimonSpawns)) return SendClientMessage(playerid, COLOR_RED, " ëì äî÷åîåú ðúôñå, ðñä ôòí äáàä");
  159. if(InRimon[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "àúä ëáø ðøùîúä ìôòéìåú");
  160. SendClientMessage(playerid, COLOR_RED, "äöèøôúä ìîìçîú äøéîåðéí,áäöìçä");
  161. GetPlayerName(playerid, playername, sizeof(playername));
  162. format(knob,sizeof(knob),"äöèøó ìôòéìåú øéîåï %s", playername);
  163. SendClientMessageToAll(COLOR_YELLOW, knob);
  164. RimonPlayers ++; InRimon[playerid] = 1;
  165. return 1; }
  166. //===============================WarEnd Command================================
  167. if(!strcmp(cmd, "/Rimonend", true)) {
  168. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "äô÷åãä ìà ðîöàä áîòøëú");
  169. if(RimonOn == 0) return SendClientMessage(playerid, COLOR_RED, " àéï ôòéìåú ëøâò");
  170. if(WS == 1) return SendClientMessage(playerid, COLOR_RED, "äôòéìåú ëáø äúçéìä");
  171. SendClientMessage(playerid, COLOR_RED, "--- äôòéìåú äúáèìä ---");
  172. Count = 0;
  173. WarEnd(2);
  174. return 1; }
  175. return 0; }
  176. //==================================WarStart====================================
  177. forward WarStart();
  178. public WarStart() {
  179. SendClientMessageToAll(COLOR_LIGHTGREEN, "~~~.--- Rimon äôòéìåú ----.~~~");
  180. format(knob, sizeof(knob), "$%d :äôøñ äåà ", Reward);
  181. SendClientMessageToAll(COLOR_PEACH, knob);
  182. SendClientMessageToAll(COLOR_YELLOW, "/rimon - ëãé ìäéöèøó ìôòéìåú");
  183. SendClientMessageToAll(COLOR_PEACH, "éù ìëí 60 ùðéåú ìäöèøó");
  184. format(knob, sizeof(knob), "î÷åîåú %d éù ø÷ ", sizeof(gRandomRimonSpawns));
  185. SendClientMessageToAll(COLOR_YELLOW, knob);
  186. SendClientMessageToAll(COLOR_LIGHTGREEN, "~~~.--- Rimon äôòéìåú ----.~~~");
  187. RimonOn = 1; RimonPlayers = 0;
  188. Count = 60; Countdown(); CountFuc = 1;
  189. return 1; }
  190. //==================================Countdown===================================
  191. forward Countdown();
  192. public Countdown() {
  193. new String[256];
  194. format(String, 256,"~R~/Rimon %d",Count); GameTextForAll(String,1000,4);
  195. if(Count > 0) {
  196. --Count;
  197. SetTimer("Countdown", 1000, 0);
  198. } else {
  199. if(CountFuc == 1) {
  200. TeleportPlayerToWar();
  201. if(knoob == 1) {
  202. Count = 10; Countdown(); CountFuc = 2;
  203. } }
  204. if(CountFuc == 2 && Count <= 0) {
  205. Unfreeze();
  206. } } }
  207. //==================================Unfreeze====================================
  208. forward Unfreeze();
  209. public Unfreeze() {
  210. for(new i;i<MAX_PLAYERS;i++) {
  211. if(PP[i] == 1) {
  212. TogglePlayerControllable(i, 1);
  213. SetCameraBehindPlayer(i);
  214. GameTextForAll("~g~Rimon Started", 3000, 0);
  215. } } }
  216. //=============================TeleportPlayerToWar==============================
  217. forward TeleportPlayerToWar();
  218. public TeleportPlayerToWar() {
  219. if(RimonPlayers < MinWarPlayers) {
  220. WarEnd(0);
  221. return 1; }
  222. for(new i;i<MAX_PLAYERS;i++) {
  223. if(InRimon[i] == 1) {
  224. new rand = random(sizeof(gRandomRimonSpawns));
  225. SetPlayerPos(i, gRandomRimonSpawns[rand][0], gRandomRimonSpawns[rand][1], gRandomRimonSpawns[rand][2]);
  226. SetPlayerInterior(i, 15);
  227. ResetPlayerWeapons(i);
  228. rand = random(sizeof(RimonWeapons));
  229. GivePlayerWeapon(i,RimonWeapons[rand],5000);
  230. SetPlayerVirtualWorld(i,1);
  231. SetPlayerArmour(i, 100.0);
  232. SetPlayerHealth(i, 100.0);
  233. WS = 1; PP[i] = 1; knoob = 1;
  234. TogglePlayerControllable(i, 0);
  235. CheckTime = SetTimer("Check",1000, 1);
  236. } }
  237. return 1; }
  238. //===================================WarEnd1====================================
  239. public OnPlayerDeath(playerid, killerid, reason) {
  240. if(PP[playerid] == 1) {
  241. RimonPlayers --; InRimon[playerid] = 0; PP[playerid] = 0;
  242. } return 1; }
  243. //===================================WarEnd=====================================
  244. forward WarEnd(status);
  245. public WarEnd(status) {
  246. if(status == 0) {
  247. SendClientMessageToAll(COLOR_WHITE, "äôòéìåú äúáèìä áâìì çåñø îùúúôéí");
  248. RimonOn = 0; RimonPlayers = 0;
  249. for(new i;i<MAX_PLAYERS;i++) {
  250. InRimon[i] = 0; PP[i] = 0; WS = 0; knoob = 0;
  251. KillTimer(CheckTime);
  252. } return 1; }
  253. else if(status == 1) {
  254. RimonOn = 0; RimonPlayers = 0;
  255. GivePlayerMoney(RimonWinner, Reward);
  256. GetPlayerName(RimonWinner, playername, sizeof(playername));
  257. ResetPlayerWeapons(RimonWinner);
  258. SetPlayerInterior(RimonWinner, 0);
  259. new rand = random(sizeof(RandSpawn));
  260. SetPlayerPos(RimonWinner, RandSpawn[rand][0], RandSpawn[rand][1], RandSpawn[rand][2]);
  261. SetPlayerVirtualWorld(RimonWinner,0);
  262. format(knob, sizeof(knob), "________________________",playername);
  263. SendClientMessageToAll(COLOR_LIGHTGREEN , knob);
  264. format(knob, sizeof(knob), "Rimon :ðéöç áôòéìåú %s",playername);
  265. SendClientMessageToAll(COLOR_WHITE, knob);
  266. format(knob, sizeof(knob), "________________________",playername);
  267. SendClientMessageToAll(COLOR_LIGHTGREEN , knob);
  268. format(knob, sizeof(knob), "--- $%d = ðéöçú áôòéìåú, ÷éáìú ---", Reward);
  269. SendClientMessage(RimonWinner,COLOR_WHITE, knob);
  270. SetPlayerArmour(RimonWinner, 100.0);
  271. SetPlayerHealth(RimonWinner, 100.0);
  272. for(new i;i<MAX_PLAYERS;i++) {
  273. InRimon[i] = 0; WS = 0; PP[i] = 0; knoob = 0;
  274. } return 1; }
  275. return 1; }
  276. //===================================Strtok=====================================
  277. stock strtok(const string[], &index) {
  278. new length = strlen(string);
  279. while ((index < length) && (string[index] <= ' ')) {
  280. index++; }
  281. new offset = index;
  282. new result[20];
  283. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
  284. result[index - offset] = string[index];
  285. index++; }
  286. result[index - offset] = EOS;
  287. return result; }
  288. //===================================Check======================================
  289. forward Check();
  290. public Check() {
  291. if(WS == 1) {
  292. if(RimonPlayers == 1) {
  293. for(new i;i<MAX_PLAYERS;i++) {
  294. if(InRimon[i] == 1) {
  295. RimonWinner = i; WarEnd(1);
  296. } } } } return 1; }
  297. //Rimon By Davidi12-LeTmE
Advertisement
Add Comment
Please, Sign In to add comment