Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.81 KB | None | 0 0
  1. /* -----------------------------------------------------------------------------------
  2.  
  3.                              Mini Missions
  4.                                Mission 1
  5.                            Author: freshOrange
  6.  
  7. -------------------------------------------------------------------------------------- */
  8. #include <a_samp>
  9. #include <zcmd>
  10. /* ----------------------------------------------------------------------------------- */
  11. new gTeam[MAX_PLAYERS];
  12. /* ----------------------------------------------------------------------------------- */
  13. #define TEAM_POLICE 0
  14. #define TEAM_MAFIA 1
  15. #define COLOR_BROWN 0x8b4513AA
  16. #define COLOR_BLUE 0xadd8e6AA
  17. /* ----------------------------------------------------------------------------------- */
  18. forward NextMission(playerid);
  19. forward UpdateTime();
  20. /* ----------------------------------------------------------------------------------- */
  21. new Time, TimeM, TimeS;
  22. new Text:Timer;
  23. new BlowTimer;
  24. /* ----------------------------------------------------------------------------------- */
  25. main()
  26. {
  27. }
  28. /* ----------------------------------------------------------------------------------- */
  29. public OnGameModeInit()
  30. {
  31.     SetTimer("NextMission",6000000,false); // 10 minutes
  32.     SetGameModeText("Mini Missions");
  33.    
  34.     Timer = TextDrawCreate(550.000000, 30.000000, "10:00");
  35.     TextDrawFont(Timer, 3);
  36.     TextDrawLetterSize(Timer, 0.600000, 1.100000);
  37.     TextDrawSetOutline(Timer, 1);
  38.     TextDrawSetShadow(Timer, 0);
  39.  
  40.     TimeM = 10;
  41.     TimeS = 0;
  42.     Time = SetTimer("UpdateTime", 1000, true);
  43.    
  44.     EnableStuntBonusForAll(0);
  45.     DisableInteriorEnterExits();
  46.    
  47.     AddPlayerClass(280,162.9307,-25.8189,1.5781,269.6755,3,1,24,50,29,200); // Police officer nr.1
  48.     AddPlayerClass(281,162.9307,-25.8189,1.5781,269.6755,3,1,24,50,29,200); // Police officer nr.2
  49.     AddPlayerClass(282,162.9307,-25.8189,1.5781,269.6755,3,1,24,50,29,200); // Police officer nr.3
  50.     AddPlayerClass(124,-107.5323,-219.7684,2.0466,84.4703,1,1,23,150,25,50); // Mafia member nr.1
  51.     AddPlayerClass(125,-107.5323,-219.7684,2.0466,84.4703,1,1,23,150,25,50); // Mafia member nr.2
  52.     AddPlayerClass(126,-107.5323,-219.7684,2.0466,84.4703,1,1,23,150,25,50); // Mafia member nr.3
  53.     // Police cars
  54.     AddStaticVehicleEx (596, 166.1790,-7.2172,1.5846,180.0846, -1, -1, 60);
  55.     AddStaticVehicleEx (596, 169.5349,-7.1033,1.3017,180.0391, -1, -1, 60);
  56.     AddStaticVehicleEx (596, 172.9866,-7.0533,1.3007,180.5353, -1, -1, 60);
  57.     AddStaticVehicleEx (596, 176.2777,-7.0842,1.2984,179.6193, -1, -1, 60);
  58.     AddStaticVehicleEx (596, 179.7451,-7.1449,1.2991,179.3092, -1, -1, 60);
  59.     AddStaticVehicleEx (596, 183.1234,-7.1395,1.2994,180.0071, -1, -1, 60);
  60.     AddStaticVehicleEx (596, 186.4222,-7.0926,1.2997,179.4864, -1, -1, 60);
  61.     AddStaticVehicleEx (596, 189.8661,-7.0732,1.2986,178.6444, -1, -1, 60);
  62.     AddStaticVehicleEx (596, 193.1977,-7.1274,1.2987,178.4328, -1, -1, 60);
  63.     AddStaticVehicleEx (596, 196.7410,-7.1193,1.2984,179.2526, -1, -1, 60);
  64.     // Mafia cars
  65.     AddStaticVehicleEx (585, -113.2624,-206.4,1.4219,178.1578, -1, -1, 60);
  66.     AddStaticVehicleEx (585, -116.9332,-206.0521,1.0138,176.4025, -1, -1, 60);
  67.     AddStaticVehicleEx (585, -120.8481,-205.3327,1.0151,174.4080, -1, -1, 60);
  68.     AddStaticVehicleEx (585, -124.7338,-204.4919,1.0146,173.0910, -1, -1, 60);
  69.     AddStaticVehicleEx (585, -128.7097,-203.7087,1.0149,172.7836, -1, -1, 60);
  70.     AddStaticVehicleEx (585, -132.5875,-202.9248,1.0158,171.1926, -1, -1, 60);
  71.     return 1;
  72. }
  73. /* ----------------------------------------------------------------------------------- */
  74. public OnPlayerConnect(playerid)
  75. {
  76.     PlayerPlaySound(playerid, 1097, -1889.2936,13.7995,38.2361);
  77.     TextDrawShowForPlayer(playerid, Timer);
  78.     return 1;
  79. }
  80. /* ----------------------------------------------------------------------------------- */
  81. public OnPlayerSpawn(playerid)
  82. {
  83.     ClearAnimations(playerid);
  84.     ApplyAnimation(playerid, "CARRY", "crry_prtial", 2.0, 0, 0, 0, 0, 0);
  85.     PlayerPlaySound(playerid,1186,162.9307,-25.8189,1.5781);
  86.     PlayerPlaySound(playerid,1186,-107.5323,-219.7684,2.0466);
  87.     SetPlayerToTeamColor(playerid);
  88.     SetPlayerCheckpoint(playerid, 244.6853,-54.9326,1.5776,1.0);
  89.     SetPlayerWeather(playerid, 1);
  90. }
  91. /* ----------------------------------------------------------------------------------- */
  92. public OnPlayerEnterCheckpoint(playerid)
  93. {
  94.     new string[128];
  95.     new playername [MAX_PLAYER_NAME];
  96.     GetPlayerName (playerid, playername, sizeof(string));
  97.     if(gTeam[playerid] == TEAM_MAFIA)
  98.     {
  99.         format (string, sizeof(string), "Attention: %s is planting the bomb!", playername);
  100.         SendClientMessageToAll (COLOR_BROWN, string);
  101.         BlowTimer = SetTimerEx("Blow", 10000, false, "i", playerid);
  102.     }
  103.     return 1;
  104. }
  105. /* ----------------------------------------------------------------------------------- */
  106. public OnPlayerLeaveCheckpoint(playerid)
  107. {
  108.     new string[128];
  109.     new playername [MAX_PLAYER_NAME];
  110.     GetPlayerName (playerid, playername, sizeof(string));
  111.     if(gTeam[playerid] == TEAM_MAFIA)
  112.     {
  113.         format (string, sizeof(string), "Attention: %s has stopped planting the bomb!", playername);
  114.         SendClientMessageToAll (COLOR_BROWN, string);
  115.         KillTimer(BlowTimer);
  116.     }
  117.     return 1;
  118. }
  119. /* ----------------------------------------------------------------------------------- */
  120. forward Blow(playerid);
  121. public Blow(playerid)
  122. {
  123.     SetTimer("NextMission",3100, true);
  124.     DisablePlayerCheckpoint(playerid);
  125.     GameTextForAll("~g~Mafia wins!~n~~n~~w~+1000", 3100, 5);
  126.     if(gTeam[playerid] == TEAM_MAFIA)
  127.     {
  128.         GivePlayerMoney(playerid, 1000);
  129.     }
  130.     CreateExplosion(244.6853,-54.9326,1.5776,6,10.0);
  131.     CreateExplosion(244.6853,-54.9326,1.5776,6,10.0);
  132.     CreateExplosion(244.6853,-54.9326,1.5776,6,10.0);
  133.     CreateExplosion(244.6853,-54.9326,1.5776,6,10.0);
  134.     CreateExplosion(244.6853,-54.9326,1.5776,6,10.0);
  135.     SetPlayerCameraPos(playerid, 233.2313,-89.3113,13.8129);
  136.     SetPlayerCameraLookAt(playerid, 252.0213,-61.7359,3.0750);
  137. }
  138. /* ----------------------------------------------------------------------------------- */
  139. public OnPlayerDeath(playerid, killerid, reason)
  140. {
  141.     if(killerid == INVALID_PLAYER_ID)
  142.     {
  143.         SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
  144.     }
  145.     else
  146.     {
  147.         SendDeathMessage(killerid,playerid,reason);
  148.         SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  149.     }
  150. }
  151. /* ----------------------------------------------------------------------------------- */
  152. public OnPlayerRequestClass(playerid, classid)
  153. {
  154.     SetPlayerPos(playerid, -1889.18,18.0183,38.2361);
  155.     SetPlayerInterior(playerid, 0);
  156.     SetPlayerFacingAngle(playerid, 180);
  157.     SetPlayerCameraPos(playerid, -1889.2936,13.7995,38.2361);
  158.     SetPlayerCameraLookAt(playerid, -1889.1069,18.1730,39.0669);
  159.     SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
  160.     SetPlayerTeamFromClass(playerid, classid);
  161.    
  162.     switch (classid)
  163.     {
  164.         case 0:
  165.         {
  166.             GameTextForPlayer(playerid, "~b~POLICE", 2000, 6);
  167.         }
  168.         case 1:
  169.         {
  170.             GameTextForPlayer(playerid, "~b~POLICE", 2000, 6);
  171.         }
  172.         case 2:
  173.         {
  174.             GameTextForPlayer(playerid, "~b~POLICE", 2000, 6);
  175.         }
  176.         case 3:
  177.         {
  178.             GameTextForPlayer(playerid, "~g~MAFIA", 2000, 6);
  179.         }
  180.         case 4:
  181.         {
  182.             GameTextForPlayer(playerid, "~g~MAFIA", 2000, 6);
  183.         }
  184.         case 5:
  185.         {
  186.             GameTextForPlayer(playerid, "~g~MAFIA", 2000, 6);
  187.         }
  188.     }
  189.     return 1;
  190. }
  191. /* ----------------------------------------------------------------------------------- */
  192. public NextMission(playerid)
  193. {
  194.     if(gTeam[playerid] == TEAM_POLICE)
  195.     {
  196.         GivePlayerMoney(playerid, 1000);
  197.         SetPlayerCameraPos(playerid, 233.2313,-89.3113,13.8129);
  198.         SetPlayerCameraLookAt(playerid, 252.0213,-61.7359,3.0750);
  199.     }
  200.     GameTextForAll("~b~Police wins!~n~~n~~w~+1000", 5000, 5);
  201.     SendRconCommand("gmx");
  202.     return 1;
  203. }
  204. /* ----------------------------------------------------------------------------------- */
  205. public UpdateTime()
  206. {
  207.     new Str[34];
  208.     TimeS --;
  209.     if(TimeM == 0 && TimeS == 0)
  210.     {
  211.         KillTimer(Time);
  212.     }
  213.     if(TimeS == -1)
  214.     {
  215.         TimeM--;
  216.         TimeS = 59;
  217.     }
  218.     format(Str, sizeof(Str), "%02d:%02d", TimeM, TimeS);
  219.     TextDrawSetString(Timer, Str);
  220.     return 1;
  221. }
  222. /* ----------------------------------------------------------------------------------- */
  223. CMD:kill(playerid, params[])
  224.     {
  225.         SetPlayerHealth(playerid, 0);
  226.         return 1;
  227.     }
  228. /* ----------------------------------------------------------------------------------- */
  229. SetPlayerTeamFromClass(playerid, classid)
  230. {
  231.     switch(classid)
  232.     {
  233.     case 0,1,2: gTeam[playerid] = TEAM_POLICE;
  234.     case 3,4,5: gTeam[playerid] = TEAM_MAFIA;
  235.     }
  236.     return 0;
  237. }
  238. /* ----------------------------------------------------------------------------------- */
  239. SetPlayerToTeamColor(playerid)
  240. {
  241.     if (gTeam[playerid] == TEAM_POLICE)
  242.     {
  243.         SetPlayerColor(playerid, COLOR_BLUE);
  244.     }
  245.     else if (gTeam[playerid] == TEAM_MAFIA)
  246.     {
  247.         SetPlayerColor(playerid, COLOR_BROWN);
  248.     }
  249. }
  250. /* ----------------------------------------------------------------------------------- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement