Advertisement
Guest User

Untitled

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