Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.86 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #define GMid 222 // edit ID..
  4.  
  5. static gTeam[MAX_PLAYERS];
  6. #define TEAM_GREEN 1
  7. #define TEAM_BLUE 2
  8. #define TEAM_NIL 255
  9. #define TEAM_GREEN_COLOR 0x33AA33FF
  10. #define TEAM_BLUE_COLOR 0x1111AAFF
  11. #define MAX_CP 18
  12.  
  13. new Counter[2];
  14. new Text:Textdraw0;
  15. new Text:Textdraw1;
  16. new timer1;
  17. new Seconds = 59;
  18. new Minutes = 4;
  19. new Text:TextdrawGwin;
  20. new Text:TextdrawBwin;
  21. new Text:TextdrawDraw;
  22. new Text:TextdrawDraw2;
  23. new ROBBERS_COUNTER = 0;
  24. new COPS_COUNTER = 0;
  25. new ROBBERS_FINISH = 0;
  26. new cpcounter[MAX_PLAYERS];
  27. new PlayersOnline;
  28. new bool:IsSpawnLocked = false;
  29. new bool:IsSpawned[MAX_PLAYERS];
  30.  
  31. forward CuentaRegresiva(playerid);
  32. new CuentaNum;
  33. new CuentaTimer;
  34.  
  35.  
  36.  
  37. // forward declarations for the PAWN compiler (not really needed, but there for the sake of clarity)
  38. forward Timer();
  39. forward CountDown(playerid);
  40. forward LockSpawn();
  41. forward TimeUpGwin(playerid);
  42. forward TimeUpBwin(playerid);
  43. forward TimeUpDraw(playerid);
  44. forward TimeUpDraw2(playerid);
  45. forward SetPlayerToTeamColor(playerid);
  46. forward SetPlayerTeamFromClass(playerid,classid);
  47. forward ExitTheGameMode();
  48. forward Count();
  49. forward CountDown(playerid);
  50. forward GetGMid();
  51. forward CheckRoundEnd();
  52. forward RoundEnd();
  53.  
  54.  
  55.  
  56.  
  57. new Float:CP[][] =
  58. {
  59. {-1711.9037, 851.2945, 23.7301},
  60. {-1713.4797, 1079.2675, 44.1636},
  61. {-1708.0636, 1187.6373, 23.9657},
  62. {-1651.2085, 1250.8431, 6.1605},
  63. {-1817.4364, 1368.6686, 6.1492},
  64. {-2041.4358, 1299.1973, 6.1170},
  65. {-2255.1399, 1261.9910, 40.9343},
  66. {-2260.8489, 1182.4492, 54.5350},
  67. {-2366.6340, 1173.6156, 39.7797},
  68. {-2468.2898, 1212.2280, 34.0509},
  69. {-2577.5676, 1228.6389, 33.9705},
  70. {-2716.2681, 1094.5690, 45.2698},
  71. {-2750.4175, 1010.7175, 53.3103},
  72. {-2667.0654, 1005.0693, 63.2258},
  73. {-2605.7737, 1011.4278, 77.1329},
  74. {-2593.7722, 1126.0298, 54.6817},
  75. {-2672.0854, 1246.8558, 54.4058},
  76. {-2691.5435, 1449.6410, 54.3746},
  77. {0.0,0.0,0.0}
  78. };
  79.  
  80.  
  81. enum PLAYER_INFOS
  82. {
  83. Float:Pos[3]
  84. };
  85.  
  86. main()
  87. {
  88. print("\n--------------------");
  89. print("Heist at Midnight");
  90. print("----------------------\n");
  91. }
  92.  
  93. public SetPlayerToTeamColor(playerid)
  94. {
  95. if(gTeam[playerid] == TEAM_GREEN) {
  96. SetPlayerColor(playerid,TEAM_GREEN_COLOR); // green
  97. } else if(gTeam[playerid] == TEAM_BLUE) {
  98. SetPlayerColor(playerid,TEAM_BLUE_COLOR); // blue
  99. }
  100. }
  101. //---------------------------------------------------------
  102.  
  103. public SetPlayerTeamFromClass(playerid,classid)
  104. {
  105. // Set their team number based on the class they selected.
  106. if(classid == 0) {
  107. gTeam[playerid] = TEAM_GREEN;
  108. } else if(classid == 1) {
  109. gTeam[playerid] = TEAM_BLUE;
  110. }
  111. }
  112.  
  113. //---------------------------------------------------------
  114.  
  115. public ExitTheGameMode()
  116. {
  117. CallRemoteFunction("ChangeGMNow", "");
  118. }
  119.  
  120. //---------------------------------------------------------
  121.  
  122. public LockSpawn()
  123. {
  124. IsSpawnLocked = true;
  125. return 1;
  126. }
  127.  
  128. //---------------------------------------------------------
  129.  
  130. public OnGameModeInit()
  131. {
  132. SetTimer("CheckRoundEnd",40000,0);
  133. SetTimer("RoundEnd", 420000, 0);
  134. SetTimer("LockSpawn",30000,0);
  135. EnableStuntBonusForAll(0);
  136. AllowInteriorWeapons(0);
  137. DisableInteriorEnterExits();
  138. UsePlayerPedAnims();
  139. ShowPlayerMarkers(1);
  140. ShowNameTags(1);
  141. CuentaTimer = SetTimer("CuentaRegresiva",1000,true);
  142. CuentaNum = 20;
  143. SetWeather(37);
  144. SetWorldTime(0);
  145.  
  146. // GREEN
  147. AddPlayerClass(86,-1731.76147,813.16803,24.82720,90.0,0,0,0,0,0,0); // GREEN 1 numbers = ID of skin.
  148.  
  149. // BLUE
  150. AddPlayerClass(280,-1720.73889,664.09387,24.61884,90.0,0,0,0,0,0,0);
  151.  
  152.  
  153. //ROB VEHS
  154. CreateVehicle(522, -1740.3068, 817.0058, 24.4609, -92.3400, -1, -1, 100);
  155. CreateVehicle(522, -1740.3358, 818.3329, 24.4609, -92.3400, -1, -1, 100);
  156. CreateVehicle(522, -1740.4033, 819.8720, 24.4609, -92.3400, -1, -1, 100);
  157. CreateVehicle(522, -1740.3258, 821.2183, 24.4609, -92.3400, -1, -1, 100);
  158. CreateVehicle(522, -1740.2010, 822.4521, 24.4609, -92.3400, -1, -1, 100);
  159. CreateVehicle(522, -1739.9679, 823.6610, 24.4609, -92.3400, -1, -1, 100);
  160. CreateVehicle(522, -1743.2605, 817.1613, 24.4609, -92.3400, -1, -1, 100);
  161. CreateVehicle(522, -1743.3934, 818.5414, 24.4609, -92.3400, -1, -1, 100);
  162. CreateVehicle(522, -1743.3486, 820.1271, 24.4609, -92.3400, -1, -1, 100);
  163. CreateVehicle(522, -1743.2694, 821.3568, 24.4609, -92.3400, -1, -1, 100);
  164. CreateVehicle(522, -1743.1116, 822.4233, 24.4609, -92.3400, -1, -1, 100);
  165. CreateVehicle(522, -1743.3208, 823.8499, 24.4609, -92.3400, -1, -1, 100);
  166. CreateVehicle(522, -1746.7809, 823.9477, 24.4609, -92.3400, -1, -1, 100);
  167. CreateVehicle(522, -1746.6797, 822.4297, 24.4609, -92.3400, -1, -1, 100);
  168. CreateVehicle(522, -1746.8799, 821.2422, 24.4609, -92.3400, -1, -1, 100);
  169. CreateVehicle(522, -1746.8276, 819.9532, 24.4609, -92.3400, -1, -1, 100);
  170. CreateVehicle(522, -1746.8027, 818.4818, 24.4609, -92.3400, -1, -1, 100);
  171. CreateVehicle(522, -1746.5829, 817.0383, 24.4609, -92.3400, -1, -1, 100);
  172. CreateVehicle(522, -1749.0814, 817.1669, 24.4609, -92.3400, -1, -1, 100);
  173. CreateVehicle(522, -1749.2391, 818.5353, 24.4609, -92.3400, -1, -1, 100);
  174. CreateVehicle(522, -1749.2570, 819.7888, 24.4609, -92.3400, -1, -1, 100);
  175. CreateVehicle(522, -1749.2826, 821.2861, 24.4609, -92.3400, -1, -1, 100);
  176. CreateVehicle(522, -1749.2168, 822.4850, 24.4609, -92.3400, -1, -1, 100);
  177. CreateVehicle(522, -1749.1638, 823.8832, 24.4609, -92.3400, -1, -1, 100);
  178. CreateVehicle(522, -1752.1196, 824.3314, 24.4609, -92.3400, -1, -1, 100);
  179. CreateVehicle(522, -1752.1725, 822.9330, 24.4609, -92.3400, -1, -1, 100);
  180. CreateVehicle(522, -1752.2094, 821.5958, 24.4609, -92.3400, -1, -1, 100);
  181. CreateVehicle(522, -1752.0392, 820.0997, 24.4609, -92.3400, -1, -1, 100);
  182. CreateVehicle(522, -1752.2012, 818.5338, 24.4609, -92.3400, -1, -1, 100);
  183. CreateVehicle(522, -1751.9855, 816.8885, 24.4609, -92.3400, -1, -1, 100);
  184. //COPS VEHS
  185. CreateVehicle(523, -1709.0222, 670.6631, 24.1289, 0.0000, -1, -1, 100);
  186. CreateVehicle(523, -1710.3422, 670.7680, 24.1289, 0.0000, -1, -1, 100);
  187. CreateVehicle(523, -1711.7770, 670.8942, 24.1289, 0.0000, -1, -1, 100);
  188. CreateVehicle(523, -1713.0083, 670.9897, 24.1289, 0.0000, -1, -1, 100);
  189. CreateVehicle(523, -1714.3348, 671.1133, 24.1289, 0.0000, -1, -1, 100);
  190. CreateVehicle(523, -1715.6138, 671.2567, 24.1289, 0.0000, -1, -1, 100);
  191. CreateVehicle(523, -1715.6855, 667.9114, 24.1289, 0.0000, -1, -1, 100);
  192. CreateVehicle(523, -1714.1833, 667.6787, 24.1289, 0.0000, -1, -1, 100);
  193. CreateVehicle(523, -1712.7971, 667.6338, 24.1289, 0.0000, -1, -1, 100);
  194. CreateVehicle(523, -1711.4644, 667.2491, 24.1289, 0.0000, -1, -1, 100);
  195. CreateVehicle(523, -1710.0245, 667.4993, 24.1289, 0.0000, -1, -1, 100);
  196. CreateVehicle(523, -1708.7184, 667.2127, 24.1289, 0.0000, -1, -1, 100);
  197. CreateVehicle(523, -1708.7557, 663.4742, 24.1289, 0.0000, -1, -1, 100);
  198. CreateVehicle(523, -1710.0848, 663.7767, 24.1289, 0.0000, -1, -1, 100);
  199. CreateVehicle(523, -1711.5157, 663.9609, 24.1289, 0.0000, -1, -1, 100);
  200. CreateVehicle(523, -1712.7754, 664.0927, 24.1289, 0.0000, -1, -1, 100);
  201. CreateVehicle(523, -1714.1863, 664.2803, 24.1289, 0.0000, -1, -1, 100);
  202. CreateVehicle(523, -1715.6696, 664.2933, 24.1289, 0.0000, -1, -1, 100);
  203. CreateVehicle(523, -1715.7933, 660.6775, 24.1289, 0.0000, -1, -1, 100);
  204. CreateVehicle(523, -1714.5375, 660.4792, 24.1289, 0.0000, -1, -1, 100);
  205. CreateVehicle(523, -1712.9611, 660.5825, 24.1289, 0.0000, -1, -1, 100);
  206. CreateVehicle(523, -1711.2935, 660.2107, 24.1289, 0.0000, -1, -1, 100);
  207. CreateVehicle(523, -1709.9381, 660.0189, 24.1289, 0.0000, -1, -1, 100);
  208. CreateVehicle(523, -1708.9203, 660.0857, 24.1289, 0.0000, -1, -1, 100);
  209. CreateVehicle(523, -1715.8799, 656.8943, 24.1289, 0.0000, -1, -1, 100);
  210. CreateVehicle(523, -1714.5161, 656.8981, 24.1289, 0.0000, -1, -1, 100);
  211. CreateVehicle(523, -1713.3291, 656.9548, 24.1289, 0.0000, -1, -1, 100);
  212. CreateVehicle(523, -1711.7474, 656.9232, 24.1289, 0.0000, -1, -1, 100);
  213. CreateVehicle(523, -1710.5306, 656.8373, 24.1289, 0.0000, -1, -1, 100);
  214. CreateVehicle(523, -1709.4635, 656.9023, 24.1289, 0.0000, -1, -1, 100);
  215.  
  216. //DECO STUFF
  217. CreateObject(1422, -2063.59375, 1305.87512, 6.39935, 0.00000, 0.00000, 43.50000);
  218. CreateObject(1422, -2061.12622, 1309.50574, 6.39935, 0.00000, 0.00000, 65.57999);
  219. CreateObject(1422, -2059.41211, 1313.83728, 6.39935, 0.00000, 0.00000, 65.57999);
  220. CreateObject(1422, -2058.65942, 1317.45203, 6.39935, 0.00000, 0.00000, 110.16000);
  221. CreateObject(1422, -2262.58057, 1169.10181, 54.94670, 0.00000, 0.00000, 23.04000);
  222. CreateObject(1422, -2268.32983, 1167.54407, 54.94670, 0.00000, 0.00000, 17.76000);
  223. CreateObject(1422, -2253.62695, 1173.22949, 54.94670, 0.00000, 0.00000, 28.50000);
  224. CreateObject(1422, -2251.40332, 1175.08850, 54.94670, 0.00000, 0.00000, 44.34000);
  225. CreateObject(1422, -2247.53467, 1181.31250, 54.94670, 0.00000, 0.00000, 56.58000);
  226. CreateObject(1422, -2245.65405, 1186.04578, 54.94670, 0.00000, 0.00000, 62.93999);
  227. CreateObject(1422, -2271.59424, 1165.85413, 55.09791, 0.00000, 0.00000, 1.56000);
  228. CreateObject(1422, -2474.38354, 1205.35791, 34.13298, 0.00000, 0.00000, -44.10000);
  229. CreateObject(1422, -2472.43848, 1203.42480, 34.13298, 0.00000, 0.00000, -44.10000);
  230. CreateObject(1422, -2469.77881, 1200.76379, 34.13298, 0.00000, 0.00000, -44.10000);
  231. CreateVehicle(427, -2065.5242, 1309.6233, 6.8825, -42.6000, -1, -1, 100);
  232. CreateVehicle(599, -2062.3306, 1317.3171, 7.0174, -184.2000, -1, -1, 100);
  233. CreateVehicle(427, -2244.5549, 1182.4834, 55.6281, 151.5000, -1, -1, 100);
  234. CreateVehicle(599, -2258.4697, 1167.4910, 55.6959, -44.1600, -1, -1, 100);
  235. CreateVehicle(599, -2252.3184, 1170.3639, 55.6959, 139.9800, -1, -1, 100);
  236. CreateVehicle(599, -2247.6521, 1176.0781, 55.6959, 139.9800, -1, -1, 100);
  237. CreateVehicle(427, -2266.1809, 1164.6744, 55.4680, -84.4800, -1, -1, 100);
  238. CreateVehicle(427, -2469.7134, 1197.6115, 35.0029, 42.3000, -1, -1, 100);
  239. CreateVehicle(427, -2476.8030, 1204.3225, 35.0029, 42.3000, -1, -1, 100);
  240. CreateObject(1422, -2466.78931, 1197.45752, 34.44517, 0.00000, 0.00000, -44.10000);
  241.  
  242. Textdraw0 = TextDrawCreate(497.000000,396.000000,"~y~Robbers: ~w~0 ~n~~r~Cops: ~w~0");
  243. TextDrawUseBox(Textdraw0,1);
  244. TextDrawBoxColor(Textdraw0,0x00000099);
  245. TextDrawTextSize(Textdraw0,591.000000,-38.000000);
  246. TextDrawAlignment(Textdraw0,0);
  247. TextDrawBackgroundColor(Textdraw0,0x000000ff);
  248. TextDrawFont(Textdraw0,2);
  249. TextDrawLetterSize(Textdraw0,0.199999,1.600000);
  250. TextDrawColor(Textdraw0,0xffffffff);
  251. TextDrawSetOutline(Textdraw0,1);
  252. TextDrawSetProportional(Textdraw0,1);
  253. TextDrawSetShadow(Textdraw0,1);
  254.  
  255. Textdraw1 = TextDrawCreate(495.000000, 3.000000, "Time Left: 05:00");
  256. TextDrawBackgroundColor(Textdraw1, 255);
  257. TextDrawFont(Textdraw1, 1);
  258. TextDrawLetterSize(Textdraw1, 0.500000, 1.800000);
  259. TextDrawColor(Textdraw1, -1);
  260. TextDrawSetOutline(Textdraw1, 0);
  261. TextDrawSetProportional(Textdraw1, 1);
  262. TextDrawSetShadow(Textdraw1, 1);
  263. timer1 = SetTimer("CountDown", 1000, true);
  264.  
  265. TextdrawGwin = TextDrawCreate(325.916656, 203.250038, "~y~Robbers ~w~escaped!"); // Green Team win
  266. TextDrawBackgroundColor(TextdrawGwin, 255);
  267. TextDrawFont(TextdrawGwin, 3);
  268. TextDrawAlignment(TextdrawGwin, 2);
  269. TextDrawLetterSize(TextdrawGwin, 0.94125, 3.760000);
  270. TextDrawColor(TextdrawGwin, -1);
  271. TextDrawSetOutline(TextdrawGwin, 0);
  272. TextDrawSetProportional(TextdrawGwin, 1);
  273. TextDrawSetShadow(TextdrawGwin, 1);
  274. TextDrawSetSelectable(TextdrawGwin, 0);
  275.  
  276. TextdrawBwin = TextDrawCreate(325.916656, 203.250038, "~r~Cops ~w~win!"); // Blue team win
  277. TextDrawBackgroundColor(TextdrawBwin, 255);
  278. TextDrawFont(TextdrawBwin, 3);
  279. TextDrawAlignment(TextdrawBwin, 2);
  280. TextDrawLetterSize(TextdrawBwin, 0.94125, 3.760000);
  281. TextDrawColor(TextdrawBwin, -1);
  282. TextDrawSetOutline(TextdrawBwin, 0);
  283. TextDrawSetProportional(TextdrawBwin, 1);
  284. TextDrawSetShadow(TextdrawBwin, 1);
  285. TextDrawSetSelectable(TextdrawBwin, 0);
  286. }
  287.  
  288. public OnGameModeExit()
  289. {
  290. TextDrawDestroy(Textdraw0);
  291. return 1;
  292. }
  293.  
  294. public OnPlayerConnect(playerid)
  295. {
  296. SetPlayerColor(playerid,0xCECECEFF);
  297. SendClientMessage(playerid,0xff59599f,"*Currently playing: ID 222 - Heist at Midnight (Last Team Standing)");
  298. TextDrawShowForPlayer(playerid,Textdraw0);
  299. TextDrawShowForPlayer(playerid,Textdraw1);
  300. return 1;
  301. }
  302.  
  303. public OnPlayerDisconnect(playerid)
  304. {
  305. if(GetPVarInt(playerid, "team") == TEAM_GREEN && GetPVarInt(playerid, "spectating") == 0 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  306. {
  307. Counter[0] -= 1;
  308. }
  309. else if(GetPVarInt(playerid, "team") == TEAM_BLUE && GetPVarInt(playerid, "spectating") == 0 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
  310. {
  311. Counter[1] -= 1;
  312. }
  313. new String[75];
  314. format(String,sizeof(String),"~y~Robbers: ~w~%d ~n~~r~Cops: ~w~%d",Counter[0],Counter[1]); // Edit names
  315. TextDrawSetString(Textdraw0, String); // ~b~ = blue :3
  316. TextDrawHideForPlayer(playerid,Textdraw0);
  317. return 1;
  318. }
  319.  
  320. //---------------------------------------------------------
  321.  
  322. public OnPlayerRequestClass(playerid, classid)
  323. {
  324. SetPlayerTeamFromClass(playerid,classid);
  325. if(classid == 0)
  326. {
  327. GameTextForPlayer(playerid,"~y~Robbers",1000,5); // Green team. Edit name
  328. SetPVarInt(playerid, "team", 1);
  329. }
  330. else if(classid == 1)
  331. {
  332. GameTextForPlayer(playerid,"~r~Cops",1000,5); // Blue team. Edit name
  333. SetPVarInt(playerid, "team", 2);
  334. }
  335. return 1;
  336. }
  337.  
  338. //---------------------------------------------------------
  339.  
  340. public OnPlayerSpawn(playerid)
  341. {
  342. SetPlayerToTeamColor(playerid);
  343. SetPlayerInterior(playerid, 0);
  344. if(IsSpawnLocked == true)
  345. {
  346. TogglePlayerSpectating(playerid,1);
  347. SetPVarInt(playerid, "team", TEAM_NIL);
  348. SetPlayerTeam(playerid,TEAM_NIL);
  349. SendClientMessage(playerid, 0xEB025F, "Click left mouse button to spectate other players");
  350. GameTextForPlayer(playerid, "Click left mouse button ~r~to change between players", 3000, 1);
  351. SetPVarInt(playerid, "spectating", 1);
  352. SetPVarInt(playerid, "blockrespawn", 1);
  353. SetPlayerColor(playerid,0xAFAFAFAA);
  354. }
  355. else
  356. {
  357. new veh = playerid+1;
  358. SetPVarInt(playerid, "spectating", 0);
  359. if(GetPVarInt(playerid, "team") == TEAM_GREEN)
  360. {
  361. PutPlayerInVehicle(playerid,veh,0);
  362. ROBBERS_COUNTER++;
  363. cpcounter[playerid] = 0;
  364. SetPlayerRaceCheckpoint(playerid,0,CP[cpcounter[playerid]][0],CP[cpcounter[playerid]][1],CP[cpcounter[playerid]][2],CP[cpcounter[playerid]+1][0],CP[cpcounter[playerid]+1][1],CP[cpcounter[playerid]+1][2],14);
  365. TogglePlayerControllable(playerid,false);
  366. CallRemoteFunction("SafeGiveWeapon","ddd", playerid, 29, 7000); // weapons of Green team..
  367. SetPlayerTeam(playerid, 1);
  368. Counter[0] += 1;
  369. }
  370. else if(GetPVarInt(playerid, "team") == TEAM_BLUE)
  371. {
  372. PutPlayerInVehicle(playerid,veh+30,0);
  373. COPS_COUNTER++;
  374. CallRemoteFunction("SafeGiveWeapon","ddd", playerid, 29, 7000); // weapons of blue team..
  375. SetPlayerTeam(playerid, 2);
  376. Counter[1] += 1;
  377. }
  378. }
  379. new String[75];
  380. format(String,sizeof(String),"~y~Robbers: ~w~%d ~n~~r~Cops: ~w~%d",Counter[0],Counter[1]); // Edit team name
  381. TextDrawSetString(Textdraw0, String);
  382.  
  383. if(IsSpawned[playerid] == true){
  384. }
  385. return 1;
  386. }
  387.  
  388. //---------------------------------------------------------
  389.  
  390. public OnPlayerDeath(playerid, killerid, reason)
  391. {
  392. IsSpawned[playerid] = false;
  393. if(IsPlayerConnected(playerid))
  394. {
  395. if(gTeam[playerid] == TEAM_GREEN && GetPVarInt(playerid, "blockrespawn") == 0 && (GetPlayerState(playerid) != PLAYER_STATE_SPECTATING))
  396. {
  397. TogglePlayerSpectating(playerid,1);
  398. ROBBERS_COUNTER--;
  399. SetPVarInt(playerid, "team", TEAM_NIL);
  400. SetPlayerTeam(playerid,TEAM_NIL);
  401. PlayerSpectatePlayer(playerid, killerid,SPECTATE_MODE_NORMAL);
  402. SendClientMessage(playerid, 0xEB025F, "Click left mouse button to spectate other players");
  403. GameTextForPlayer(playerid, "Click left mouse button ~r~to change between players", 3000, 1);
  404. SetPVarInt(playerid, "spectating", 1);
  405. SetPVarInt(playerid, "blockrespawn", 1);
  406. SetPlayerColor(playerid,0xAFAFAFAA);
  407. Counter[0] -= 1;
  408. }
  409. else if(gTeam[playerid] == TEAM_BLUE && GetPVarInt(playerid, "blockrespawn") == 0 && (GetPlayerState(playerid) != PLAYER_STATE_SPECTATING))
  410. {
  411. TogglePlayerSpectating(playerid,1);
  412. COPS_COUNTER--;
  413. SetPVarInt(playerid, "team", TEAM_NIL);
  414. SetPlayerTeam(playerid,TEAM_NIL);
  415. PlayerSpectatePlayer(playerid, killerid,SPECTATE_MODE_NORMAL);
  416. SendClientMessage(playerid, 0xEB025F, "Click left mouse button to spectate other players");
  417. GameTextForPlayer(playerid, "Click left mouse button ~r~to change between players", 3000, 1);
  418. SetPVarInt(playerid, "spectating", 1);
  419. SetPVarInt(playerid, "blockrespawn", 1);
  420. SetPlayerColor(playerid,0xAFAFAFAA);
  421. Counter[1] -= 1;
  422. }
  423. else
  424. {
  425. TogglePlayerSpectating(playerid,1);
  426. SetPVarInt(playerid, "team", TEAM_NIL);
  427. SetPlayerTeam(playerid,TEAM_NIL);
  428. PlayerSpectatePlayer(playerid, killerid,SPECTATE_MODE_NORMAL);
  429. SendClientMessage(playerid, 0xEB025F, "You are late, the game already started");
  430. SendClientMessage(playerid, 0xEB025F, "Click left mouse button to spectate other players");
  431. GameTextForPlayer(playerid, "Click left mouse button ~r~to change between players", 3000, 1);
  432. SetPVarInt(playerid, "spectating", 1);
  433. SetPVarInt(playerid, "blockrespawn", 1);
  434. SetPlayerColor(playerid,0xAFAFAFAA);
  435. }
  436. new String[75];
  437. format(String,sizeof(String),"~y~Robbers: ~w~%d ~n~~r~Cops: ~w~%d",Counter[0],Counter[1]);
  438. TextDrawSetString(Textdraw0, String); // edit team name
  439. }
  440. if(gTeam[killerid] != gTeam[playerid])
  441. {
  442. GiveMoney(killerid,20);
  443. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  444. }
  445. return 1;
  446. }
  447.  
  448. //---------------------------------------------------------
  449.  
  450. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  451. {
  452. if (newkeys & KEY_FIRE)
  453. {
  454. if(GetPVarInt(playerid, "spectating") == 1)
  455. {
  456. PlayerSpectatePlayer(playerid, RandomPlayer(),SPECTATE_MODE_NORMAL);
  457. }
  458. }
  459. return 1;
  460. }
  461.  
  462.  
  463. public OnPlayerEnterRaceCheckpoint(playerid)
  464. {
  465. if(cpcounter[playerid] < 17){
  466. cpcounter[playerid]++;
  467. SetPlayerRaceCheckpoint(playerid,0,CP[cpcounter[playerid]][0],CP[cpcounter[playerid]][1],CP[cpcounter[playerid]][2],CP[cpcounter[playerid]+1][0],CP[cpcounter[playerid]+1][1],CP[cpcounter[playerid]+1][2],14);
  468. } else if(cpcounter[playerid] >= 17){
  469. DisablePlayerRaceCheckpoint(playerid);
  470. SetPlayerVirtualWorld(playerid,13);
  471. ROBBERS_FINISH++;
  472. cpcounter[playerid]= -1;
  473. GameTextForPlayer(playerid,"Winner",5000,5);
  474. }
  475. }
  476.  
  477.  
  478.  
  479.  
  480.  
  481. public OnPlayerRequestSpawn(playerid)
  482. {
  483. /*
  484. if(CallRemoteFunction("IsPlayerVIP", "i", playerid)) return 1;
  485. new team1count, team2count;
  486. for(new i, m = GetMaxPlayers(); i < m; i++)
  487. {
  488. if (IsPlayerConnected(i))
  489. {
  490. if (gTeam[i] == TEAM_GREEN) team1count++;
  491. else if (gTeam[i] == TEAM_BLUE) team2count++;
  492. }
  493. }
  494. if (gTeam[playerid] == TEAM_GREEN)
  495. {
  496. if(team1count > team2count)
  497. {
  498. SendClientMessage(playerid, 0xE60000FF, "To balance the teams, please select the other team.");
  499. return 0;
  500. }
  501. }
  502. else if (gTeam[playerid] == TEAM_BLUE)
  503. {
  504. if (team2count > team1count)
  505. {
  506. SendClientMessage(playerid, 0xE60000FF, "To balance the teams, please select the other team.");
  507. return 0;
  508. }
  509. }
  510.  
  511. return 1;
  512. }
  513. */
  514.  
  515.  
  516.  
  517. if(CallRemoteFunction("IsPlayerVIP", "i", playerid)) return 1;
  518. new team1count, team2count;
  519. PlayersOnline++;
  520. for(new i, m = GetMaxPlayers(); i < m; i++)
  521. {
  522. if (IsPlayerConnected(i))
  523. {
  524. if (gTeam[i] == TEAM_GREEN) team1count++;
  525. else if (gTeam[i] == TEAM_BLUE) team2count++;
  526. }
  527. }
  528. if (gTeam[playerid] == TEAM_GREEN)
  529. {
  530. if(team1count > team2count+1)
  531. {
  532. SendClientMessage(playerid, 0xE60000FF, "To balance the teams, please select the other team.");
  533. return 0;
  534. }
  535. }
  536. else if (gTeam[playerid] == TEAM_BLUE)
  537. {
  538. if (team2count > team1count+1)
  539. {
  540. SendClientMessage(playerid, 0xE60000FF, "To balance the teams, please select the other team.");
  541. return 0;
  542. }
  543. }
  544.  
  545. return 1;
  546. }
  547.  
  548.  
  549. //---------------------------------------------------------
  550.  
  551. public GetGMid()
  552. {
  553. return GMid;
  554. }
  555.  
  556. //---------------------------------------------------------
  557.  
  558. public CountDown(playerid)
  559. {
  560. Seconds--;
  561. if(Seconds <= -1)
  562. {
  563. Minutes--;
  564. Seconds = 59;
  565. }
  566. else if(Minutes <= 0 && Seconds <= 0)
  567. {
  568. KillTimer(timer1);
  569. }
  570. new string[178];
  571. format(string,sizeof(string),"Time Left: %02d:%02d",Minutes, Seconds);
  572. TextDrawSetString(Textdraw1,string);
  573. return 1;
  574. }
  575.  
  576. //---------------------------------------------------------
  577.  
  578. public CheckRoundEnd()
  579. {
  580. new HalfPlayers = PlayersOnline/2;
  581. if(ROBBERS_COUNTER < HalfPlayers || ROBBERS_COUNTER == 0)
  582. {
  583. TextDrawShowForAll(TextdrawBwin);
  584. SetTimer("TimeUpBwin", 6000, false);
  585. for (new i=0; i<MAX_PLAYERS; i++)
  586. {
  587. if (IsPlayerConnected(i) && gTeam[i] == TEAM_BLUE && GetPlayerState(i) == PLAYER_STATE_ONFOOT)
  588. {
  589. CallRemoteFunction("AddPlayerSurvivedCount","d",i);
  590. SetPlayerScore(i,GetPlayerScore(i)+5);
  591. GiveMoney(i,1000);
  592. }
  593. }
  594. SetTimer("ExitTheGameMode",3500,0);
  595. }
  596. else if(ROBBERS_FINISH >= HalfPlayers)
  597. {
  598. TextDrawShowForAll(TextdrawGwin);
  599. SetTimer("TimeUpGwin", 6000, false);
  600. for (new i=0; i<MAX_PLAYERS; i++)
  601. {
  602. if (IsPlayerConnected(i) && gTeam[i] == TEAM_GREEN && GetPlayerState(i) == PLAYER_STATE_ONFOOT)
  603. {
  604. CallRemoteFunction("AddPlayerSurvivedCount","d",i);
  605. SetPlayerScore(i,GetPlayerScore(i)+5);
  606. GiveMoney(i,1000);
  607. }
  608. }
  609. SetTimer("ExitTheGameMode",3500,0);
  610. }
  611. }
  612.  
  613. //---------------------------------------------------------
  614.  
  615. public RoundEnd()
  616. {
  617. new HalfPlayers = PlayersOnline/2;
  618.  
  619. if(ROBBERS_COUNTER < HalfPlayers ||ROBBERS_COUNTER == 0)
  620. {
  621. TextDrawShowForAll(TextdrawBwin);
  622. SetTimer("TimeUpBwin", 6000, false);
  623. for (new i=0; i<MAX_PLAYERS; i++)
  624. {
  625. if (IsPlayerConnected(i) && gTeam[i] == TEAM_BLUE)
  626. {
  627. SetPlayerScore(i,GetPlayerScore(i)+5);
  628. GiveMoney(i,1000);
  629. }
  630. }
  631. SetTimer("ExitTheGameMode",3500,0);
  632. }
  633. if(ROBBERS_FINISH >= HalfPlayers)
  634. {
  635. TextDrawShowForAll(TextdrawGwin);
  636. SetTimer("TimeUpGwin", 6000, false);
  637. for (new i=0; i<MAX_PLAYERS; i++)
  638. {
  639. if (IsPlayerConnected(i) && gTeam[i] == TEAM_GREEN)
  640. {
  641. SetPlayerScore(i,GetPlayerScore(i)+5);
  642. GiveMoney(i,1000);
  643. }
  644. }
  645. SetTimer("ExitTheGameMode",3500,0);
  646. }
  647. }
  648.  
  649. //STOCKS
  650.  
  651. stock RandomPlayer()
  652. {
  653. new yplayer[MAX_PLAYERS+1];
  654. for (new y = 0; y != MAX_PLAYERS; y ++) {
  655. new Float:health;
  656. GetPlayerHealth(y,health);
  657. if (IsPlayerConnected(y) && health > 0 && GetPlayerState(y) == PLAYER_STATE_ONFOOT) {
  658. yplayer[0] ++;
  659. yplayer[yplayer[0]] = y;
  660. }
  661. }
  662. if (yplayer[0] == 0) return -1;
  663. return yplayer[random(yplayer[0])+1];
  664. }
  665.  
  666. stock PlayerName(playerid)
  667. {
  668. new name[24];
  669. GetPlayerName(playerid, name, 24);
  670. return name;
  671. }
  672.  
  673.  
  674.  
  675. stock GiveMoney(playerid, amount)
  676. {
  677. CallRemoteFunction("GivePlayerCash","dd", playerid, amount);
  678. }
  679. public TimeUpGwin()
  680. {
  681. TextDrawHideForAll(TextdrawGwin);
  682. }
  683.  
  684. public TimeUpBwin()
  685. {
  686. TextDrawHideForAll(TextdrawBwin);
  687. }
  688. public TimeUpDraw()
  689. {
  690. TextDrawHideForAll(TextdrawDraw);
  691. }
  692. public TimeUpDraw2()
  693. {
  694. TextDrawHideForAll(TextdrawDraw2);
  695. }
  696.  
  697. public CuentaRegresiva(playerid){
  698. if(CuentaNum > 0){
  699. for(new i; i < MAX_PLAYERS; i++){
  700. TogglePlayerControllable(i,false);
  701. }
  702. new conteotext[256];format(conteotext,sizeof(conteotext),"%i",CuentaNum);
  703. GameTextForAll(conteotext,1000,5);
  704. CuentaNum --;
  705. } else {
  706. GameTextForAll("GOOO!!!",1000,5);
  707. KillTimer(CuentaTimer);
  708. CuentaNum = -1;
  709. for(new i; i < MAX_PLAYERS; i++){
  710. TogglePlayerControllable(i,true);
  711. }
  712. }
  713. return 1;
  714. }
  715.  
  716. CMD:statics(playerid,params[]){
  717. new textt[256];
  718. format(textt,sizeof(textt),"Players Spawneados: %i", PlayersOnline);
  719. SendClientMessage(playerid,0xFF0000,textt);
  720. format(textt,sizeof(textt),"Players Robbers que ganaron: %i", ROBBERS_FINISH);
  721. SendClientMessage(playerid,0xFF0000,textt);
  722. return 1;
  723. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement