Advertisement
iJoao

Sniper's vs Corredores

Jul 12th, 2016
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.33 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new RHINO[2], OBJETO[46], SNIPER[5], bool:EventoOn, bool:FoiEvento[MAX_PLAYERS], TeamSNP, TeamRUN, pTeamSNP, pTeamRUN;
  4. new Float:PosTeamSNP[3][4] =
  5. {
  6. {1567.7367,-2549.5454,70.3809,91.8311}, // posicao dos atiradores de leite
  7. {1567.0582,-2542.9116,70.3809,89.3244}, // posicao dos atiradores de leite
  8. {1568.1614,-2535.1489,70.3809,87.4444} // posicao dos atiradores de leite
  9. };
  10. new Float:PosTeamRUN[3][4] =
  11. {
  12. {1509.1761,-2581.9883,61.5809,1.2766}, // posicao dos pernalonga
  13. {1509.1761,-2581.9883,61.5809,1.2766}, // posicao dos pernalonga
  14. {1509.1761,-2581.9883,61.5809,1.2766} // posicao dos pernalonga
  15. };
  16. forward EventoAberto();
  17. forward RespawnWeapon();
  18. public OnFilterScriptInit()
  19. {
  20. print("\n|==================================|");
  21. print("|==== SNIPERS vs CORREDORES ====|");
  22. print("|===== by iJoao ======|");
  23. print("|==================================|\n");
  24. CarregarSNPxRUN();
  25. EventoOn = true;
  26. for(new i; i < MAX_PLAYERS; i++) FoiEvento[i] = false;
  27. pTeamSNP = 0;
  28. pTeamRUN = 0;
  29. SetTimer("EventoAberto", 5000, false);
  30. SetTimer("RespawnWeapon", 5000, true);
  31. return 1;
  32. }
  33. public OnFilterScriptExit()
  34. {
  35. EventoOn = false;
  36. pTeamSNP = 0;
  37. pTeamRUN = 0;
  38. for(new i; i < MAX_PLAYERS; i++) FoiEvento[i] = false;
  39. for(new ID; ID != sizeof(RHINO); ID++) DestroyVehicle(RHINO[ID]);
  40. for(new OBJ; OBJ < sizeof(OBJETO); OBJ++) DestroyObject(OBJETO[OBJ]);
  41. return 1;
  42. }
  43. public OnPlayerCommandText(playerid, cmdtext[])
  44. {
  45. if(!strcmp(cmdtext, "/iniciar", true))
  46. {
  47. if(IsPlayerAdmin(playerid))
  48. {
  49. for(new i; i < MAX_PLAYERS; i++)
  50. {
  51. if(FoiEvento[i] == true)
  52. {
  53. TogglePlayerControllable(i, true);
  54. GameTextForPlayer(i, "~g~evento iniciado", 5000, 1);
  55. }
  56. }
  57. }
  58. return 1;
  59. }
  60. if(!strcmp(cmdtext, "/irevento", true))
  61. {
  62. if(EventoOn == false) return SendClientMessage(playerid, 0xFF0000AA, "[ERRO]: Nenhum evento está ativo no momento!");
  63. if(FoiEvento[playerid] == true) return SendClientMessage(playerid, 0xFF0000AA, "[ERRO]: Você já está participando de um evento!");
  64. if(pTeamSNP == pTeamRUN) //Se Corredores = numero de snipers > ENTRA COMO SNIPER
  65. {
  66. new pRandom = random(sizeof(PosTeamSNP));
  67. SetPlayerPos(playerid, PosTeamSNP[pRandom][0], PosTeamSNP[pRandom][1], PosTeamSNP[pRandom][2]);
  68. SetPlayerFacingAngle(playerid, PosTeamSNP[pRandom][3]);
  69. SetPlayerVirtualWorld(playerid, 333);
  70. SetPlayerTeam(playerid, TeamSNP);
  71. pTeamSNP++;
  72. FoiEvento[playerid] = true;
  73. TogglePlayerControllable(playerid, false);
  74. return 1;
  75. }
  76. if(pTeamSNP < pTeamRUN) //Se Corredores é maior que numero de snipers > ENTRA COMO SNIPER
  77. {
  78. new pRandom = random(sizeof(PosTeamSNP));
  79. SetPlayerPos(playerid, PosTeamSNP[pRandom][0], PosTeamSNP[pRandom][1], PosTeamSNP[pRandom][2]);
  80. SetPlayerFacingAngle(playerid, PosTeamSNP[pRandom][3]);
  81. SetPlayerVirtualWorld(playerid, 333);
  82. SetPlayerTeam(playerid, TeamSNP);
  83. pTeamSNP++;
  84. FoiEvento[playerid] = true;
  85. TogglePlayerControllable(playerid, false);
  86. return 1;
  87. }
  88. if(pTeamSNP > pTeamRUN) //Se Tiver menos corredores que snipers > ENTRA COMO CORREDOR
  89. {
  90. new pRandom = random(sizeof(PosTeamRUN));
  91. SetPlayerPos(playerid, PosTeamRUN[pRandom][0], PosTeamRUN[pRandom][1], PosTeamRUN[pRandom][2]);
  92. SetPlayerFacingAngle(playerid, PosTeamRUN[pRandom][3]);
  93. SetPlayerVirtualWorld(playerid, 333);
  94. SetPlayerTeam(playerid, TeamRUN);
  95. pTeamRUN++;
  96. FoiEvento[playerid] = true;
  97. TogglePlayerControllable(playerid, false);
  98. return 1;
  99. }
  100. }
  101. return 0;
  102. }
  103. public OnPlayerPickUpPickup(playerid, pickupid)
  104. {
  105. if(pickupid == SNIPER[0]) {GivePlayerWeapon(playerid, 34, 5);}
  106. if(pickupid == SNIPER[1]) {GivePlayerWeapon(playerid, 34, 5);}
  107. if(pickupid == SNIPER[2]) {GivePlayerWeapon(playerid, 34, 5);}
  108. if(pickupid == SNIPER[3]) {GivePlayerWeapon(playerid, 34, 5);}
  109. if(pickupid == SNIPER[4]) {GivePlayerWeapon(playerid, 34, 5);}
  110. return 1;
  111. }
  112. public RespawnWeapon()
  113. {
  114. SNIPER[0] = CreatePickup(358,2,1572.104248,-2533.082031,70.380889, 333);
  115. SNIPER[1] = CreatePickup(358,2,1572.360351,-2537.915283,70.380889, 333);
  116. SNIPER[2] = CreatePickup(358,2,1572.140747,-2541.718750,70.380889, 333);
  117. SNIPER[3] = CreatePickup(358,2,1572.158081,-2545.733154,70.380889, 333);
  118. SNIPER[4] = CreatePickup(358,2,1572.395996,-2550.756347,70.380889, 333);
  119. return 1;
  120. }
  121. public EventoAberto()
  122. {
  123. GameTextForAll("~g~evento disponivel ~b~use ~r~/irevento", 5000, 1);
  124. return 1;
  125. }
  126. stock CarregarSNPxRUN()
  127. {
  128. OBJETO[0] = CreateObject(3585, 1509.1, -2557.8999, 60.8, 0, 0, 270, 333);
  129. OBJETO[1] = CreateObject(3378, 1565.8, -2541.5, 68.2, 0, 0, 0, 333);
  130. OBJETO[2] = CreateObject(3378, 1571.5, -2541.3999, 68.2, 0, 0, 0, 333);
  131. OBJETO[3] = CreateObject(3378, 1508.7, -2573.2, 59.4, 0, 0, 0, 333);
  132. OBJETO[4] = CreateObject(3378, 1512.4, -2573.1001, 60.7, 0, 90, 180, 333);
  133. OBJETO[5] = CreateObject(18244, 1510.7, -2559.2, 63.7, 89.512, 180.001, 90.487, 333);
  134. OBJETO[6] = CreateObject(3585, 1508.9, -2553.3, 63.3, 0, 0, 0, 333);
  135. OBJETO[7] = CreateObject(3585, 1509.2, -2548.3999, 60.8, 0, 0, 270, 333);
  136. OBJETO[8] = CreateObject(3571, 1509.2, -2540.8999, 63.8, 0, 0, 90, 333);
  137. OBJETO[9] = CreateObject(18244, 1510.8, -2542.8, 65.7, 89.511, 180, 90.483, 333);
  138. OBJETO[10] = CreateObject(3571, 1509.2, -2534.1001, 63.8, 0, 0, 90, 333);
  139. OBJETO[11] = CreateObject(3571, 1509.2, -2523.6001, 63.8, 0, 0, 90, 333);
  140. OBJETO[12] = CreateObject(18244, 1510.8, -2527.5, 66.4, 89.506, 179.995, 90.478, 333);
  141. OBJETO[13] = CreateObject(18244, 1510.8, -2521.6001, 66.4, 89.506, 179.995, 90.478, 333);
  142. OBJETO[14] = CreateObject(3571, 1509.2, -2517, 65.5, 0, 0, 90, 333);
  143. OBJETO[15] = CreateObject(3585, 1511.6, -2517.1001, 67.8, 0, 0, 270, 333);
  144. OBJETO[16] = CreateObject(3571, 1516.2, -2516.8999, 65.5, 0, 0, 0, 333);
  145. OBJETO[17] = CreateObject(3571, 1522.5, -2516.8999, 65.5, 0, 0, 0, 333);
  146. OBJETO[18] = CreateObject(3571, 1526.6, -2516.3, 68, 0, 0, 90, 333);
  147. OBJETO[19] = CreateObject(18244, 1510.7, -2533, 67.9, 89.506, 179.995, 90.478, 333);
  148. OBJETO[20] = CreateObject(647, 1515.4, -2518.6001, 68.4, 0, 0, 0, 333);
  149. OBJETO[21] = CreateObject(647, 1516.6, -2519, 68.4, 0, 0, 0, 333);
  150. OBJETO[22] = CreateObject(3571, 1524.1, -2512.8, 65.5, 0, 0, 90, 333);
  151. OBJETO[23] = CreateObject(3571, 1525.7, -2508.3, 65.5, 0, 0, 90, 333);
  152. OBJETO[24] = CreateObject(3571, 1526.6, -2508.5, 68, 0, 0, 90, 333);
  153. OBJETO[25] = CreateObject(3571, 1524.5, -2500.6001, 68, 0, 0, 90, 333);
  154. OBJETO[26] = CreateObject(18244, 1525.9, -2505.1001, 69.1, 0, 270, 358.967, 333);
  155. OBJETO[27] = CreateObject(3571, 1524.5, -2495.3, 68, 0, 0, 90, 333);
  156. OBJETO[28] = CreateObject(3585, 1527, -2492.3999, 70.3, 0, 0, 270, 333);
  157. OBJETO[29] = CreateObject(3585, 1527, -2497.2, 70.3, 0, 0, 270, 333);
  158. OBJETO[30] = CreateObject(3571, 1529.9, -2492.5, 68, 0, 0, 0, 333);
  159. OBJETO[31] = CreateObject(647, 1529.2, -2496.8999, 70.4, 0, 0, 0, 333);
  160. OBJETO[32] = CreateObject(647, 1529.3, -2497.6001, 70.4, 0, 0, 0, 333);
  161. OBJETO[33] = CreateObject(647, 1529.1, -2492.7, 70.4, 0, 0, 0, 333);
  162. OBJETO[34] = CreateObject(647, 1529.1, -2492.2, 70.4, 0, 0, 0, 333);
  163. OBJETO[35] = CreateObject(3571, 1537.2, -2492.5, 68, 0, 0, 0, 333);
  164. OBJETO[36] = CreateObject(3571, 1544.8, -2491, 70, 0, 0, 20, 333);
  165. OBJETO[37] = CreateObject(3378, 1568.3, -2496.3, 71.9, 0, 0, 90, 333);
  166. OBJETO[38] = CreateObject(3378, 1568.2, -2487.3999, 69.2, 0, 0, 90, 333);
  167. OBJETO[39] = CreateObject(3378, 1568.1, -2491.8, 70.7, 0, 30, 90, 333);
  168. OBJETO[40] = CreateObject(3378, 1568.3, -2481.8999, 69.2, 0, 0, 90, 333);
  169. OBJETO[41] = CreateObject(3378, 1568.3, -2476.3999, 69.2, 0, 0, 90, 333);
  170. OBJETO[42] = CreateObject(3378, 1568.2, -2501.8, 71.9, 0, 0, 90, 333);
  171. OBJETO[43] = CreateObject(3571, 1550.4, -2487, 70, 0, 0, 51.995, 333);
  172. OBJETO[44] = CreateObject(3571, 1554.8, -2482.6001, 70, 0, 0, 33.993, 333);
  173. OBJETO[45] = CreateObject(18244, 1540.9, -2493.8, 71.7, 89.5, 179.995, 12.473, 333);
  174. RHINO[0] = AddStaticVehicle(432,1574.5818,-2482.9419,71.3882,179.7443,43,60000); // rhino 1
  175. RHINO[1] = AddStaticVehicle(432,1566.6100,-2482.9294,71.3882,179.9532,43,60000); // rhino 2
  176. for(new ID; ID != sizeof(RHINO); ID++) SetVehicleVirtualWorld(RHINO[ID], 333), SetVehicleHealth(RHINO[ID], 10000);
  177. return 1;
  178. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement