Guest User

Untitled

a guest
Jul 13th, 2011
1,008
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.92 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", 8000, 5);
  126.     if(gTeam[playerid] == TEAM_MAFIA)
  127.     {
  128.         GivePlayerMoney(playerid, 1000);
  129.         SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
  130.     }
  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.     CreateExplosion(244.6853,-54.9326,1.5776,6,10.0);
  136.     SetPlayerCameraPos(playerid, 233.2313,-89.3113,13.8129);
  137.     SetPlayerCameraLookAt(playerid, 252.0213,-61.7359,3.0750);
  138. }
  139. /* ----------------------------------------------------------------------------------- */
  140. public OnPlayerDeath(playerid, killerid, reason)
  141. {
  142.     if(killerid == INVALID_PLAYER_ID)
  143.     {
  144.         SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
  145.     }
  146.     else
  147.     {
  148.         SendDeathMessage(killerid,playerid,reason);
  149.         SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  150.     }
  151. }
  152. /* ----------------------------------------------------------------------------------- */
  153. public OnPlayerRequestClass(playerid, classid)
  154. {
  155.     SetPlayerPos(playerid, -1889.18,18.0183,38.2361);
  156.     SetPlayerInterior(playerid, 0);
  157.     SetPlayerFacingAngle(playerid, 180);
  158.     SetPlayerCameraPos(playerid, -1889.2936,13.7995,38.2361);
  159.     SetPlayerCameraLookAt(playerid, -1889.1069,18.1730,39.0669);
  160.     SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
  161.     SetPlayerTeamFromClass(playerid, classid);
  162.    
  163.     switch (classid)
  164.     {
  165.         case 0:
  166.         {
  167.             GameTextForPlayer(playerid, "~b~POLICE", 2000, 6);
  168.         }
  169.         case 1:
  170.         {
  171.             GameTextForPlayer(playerid, "~b~POLICE", 2000, 6);
  172.         }
  173.         case 2:
  174.         {
  175.             GameTextForPlayer(playerid, "~b~POLICE", 2000, 6);
  176.         }
  177.         case 3:
  178.         {
  179.             GameTextForPlayer(playerid, "~g~MAFIA", 2000, 6);
  180.         }
  181.         case 4:
  182.         {
  183.             GameTextForPlayer(playerid, "~g~MAFIA", 2000, 6);
  184.         }
  185.         case 5:
  186.         {
  187.             GameTextForPlayer(playerid, "~g~MAFIA", 2000, 6);
  188.         }
  189.     }
  190.     return 1;
  191. }
  192. /* ----------------------------------------------------------------------------------- */
  193. public NextMission(playerid)
  194. {
  195.     if(gTeam[playerid] == TEAM_POLICE)
  196.     {
  197.         GivePlayerMoney(playerid, 1000);
  198.         SetPlayerCameraPos(playerid, 233.2313,-89.3113,13.8129);
  199.         SetPlayerCameraLookAt(playerid, 252.0213,-61.7359,3.0750);
  200.         SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
  201.     }
  202.     GameTextForAll("~b~Police wins!~n~~n~~w~+1000", 5000, 5);
  203.     SendRconCommand("gmx");
  204.     return 1;
  205. }
  206. /* ----------------------------------------------------------------------------------- */
  207. public UpdateTime()
  208. {
  209.     new Str[34];
  210.     TimeS --;
  211.     if(TimeM == 0 && TimeS == 0)
  212.     {
  213.         KillTimer(Time);
  214.     }
  215.     if(TimeS == -1)
  216.     {
  217.         TimeM--;
  218.         TimeS = 59;
  219.     }
  220.     format(Str, sizeof(Str), "%02d:%02d", TimeM, TimeS);
  221.     TextDrawSetString(Timer, Str);
  222.     return 1;
  223. }
  224. /* ----------------------------------------------------------------------------------- */
  225. CMD:kill(playerid, params[])
  226.     {
  227.         SetPlayerHealth(playerid, 0);
  228.         return 1;
  229.     }
  230. /* ----------------------------------------------------------------------------------- */
  231. SetPlayerTeamFromClass(playerid, classid)
  232. {
  233.     switch(classid)
  234.     {
  235.     case 0,1,2: gTeam[playerid] = TEAM_POLICE;
  236.     case 3,4,5: gTeam[playerid] = TEAM_MAFIA;
  237.     }
  238.     return 0;
  239. }
  240. /* ----------------------------------------------------------------------------------- */
  241. SetPlayerToTeamColor(playerid)
  242. {
  243.     if (gTeam[playerid] == TEAM_POLICE)
  244.     {
  245.         SetPlayerColor(playerid, COLOR_BLUE);
  246.     }
  247.     else if (gTeam[playerid] == TEAM_MAFIA)
  248.     {
  249.         SetPlayerColor(playerid, COLOR_BROWN);
  250.     }
  251. }
  252. /* ----------------------------------------------------------------------------------- */
Advertisement
Add Comment
Please, Sign In to add comment