Guest User

Jordan

a guest
Dec 30th, 2008
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 10.03 KB | None | 0 0
  1. /*
  2. ________________________
  3. |    Doherty           |
  4. |       Break-In       |
  5. |              By      |
  6. |               Jordan |
  7. ________________________
  8.  
  9. Copyright (c) Jordan / Butters
  10. */
  11.  
  12.  
  13. #include <a_samp>
  14. #include <a_vehicles>
  15.  
  16.  
  17.  
  18. #define TEAM_ATTACK 1
  19.  
  20. #define TEAM_DEFENCE 2
  21.  
  22.  
  23.  
  24. #define CHECKPOINT_NONE 0
  25.  
  26. #define CHECKPOINT_PLANE 1
  27.  
  28. #define CHECKPOINT_DOHERTY 2
  29.  
  30.  
  31.  
  32. #define DEFENCE_WIN 0
  33.  
  34. #define ATTACK_WIN 1
  35.  
  36.  
  37.  
  38. #define COLOR_GREY 0xAFAFAFAA
  39.  
  40. #define COLOR_GREEN 0x33AA33AA
  41.  
  42. #define COLOR_RED 0xAA3333AA
  43.  
  44. #define COLOR_YELLOW 0xFFFF00AA
  45.  
  46. #define blue 0x375FFFFF
  47.  
  48.  
  49.  
  50. forward DefenceWin();
  51.  
  52. forward GameModeExitFunc();
  53.  
  54. forward SettingPlayerTeam();
  55.  
  56.  
  57.  
  58.  
  59. new gTeam[MAX_PLAYERS];
  60.  
  61. new gPlayerClass[MAX_PLAYERS];
  62.  
  63. new gPlayerCheckpointStatus[MAX_PLAYERS];
  64.  
  65. new gRoundTimer;
  66.  
  67.  
  68.  
  69. // If the army defend the lab for this amount of time, they win.
  70.  
  71. //new gRoundTime = 1200000;                 // Round time - 20 mins
  72.  
  73. //new gRoundTime = 900000;                  // Round time - 15 mins
  74.  
  75. new gRoundTime = 600000;                    // Round time - 10 mins
  76.  
  77. //new gRoundTime = 300000;                  // Round time - 5 mins
  78.  
  79. //new gRoundTime = 120000;                  // Round time - 2 mins
  80.  
  81. //new gRoundTime = 60000;                   // Round time - 1 min
  82.  
  83.  
  84.  
  85. //---------------------------------------------------------
  86.  
  87.  
  88.  
  89. main()
  90.  
  91. {
  92.  
  93.     print("\n----------------------------------");
  94.  
  95.     print("  Doherty break-in\n  Made By Jordan (2008 / 2009)");
  96.  
  97.     print("----------------------------------\n");
  98.  
  99. }
  100.  
  101.  
  102.  
  103. //---------------------------------------------------------
  104.  
  105.  
  106.  
  107. public OnGameModeInit()
  108.  
  109. {
  110.  
  111.  
  112.  
  113.     SetGameModeText("[Xs] Doherty Break-In");
  114.  
  115.     ShowNameTags(1);
  116.  
  117.     ShowPlayerMarkers(0);
  118.  
  119.     SetWorldTime(13);
  120.    
  121.     UsePlayerPedAnims();
  122.  
  123.  
  124.  
  125.     // Attack team
  126.  
  127.     AddPlayerClass(111,315.4792,984.1290,1959.1129,353.5, 27, 9999, 34, 9999, 24, 9999); // Mafia dude, andromeda
  128.    
  129.     AddPlayerClass(113,-1992.2727,141.6075,27.5391,94.8659, 27, 9999, 24, 9999, 31, 9999);
  130.  
  131.  
  132.  
  133.     // Defence team
  134.  
  135.     AddPlayerClass(287,-2164.8022,-241.1310,46.3121,101.4790, 24, 9999, 27, 9999, 31, 5000); // Army
  136.  
  137.     AddPlayerClass(70,-2140.2090,-233.1173,36.5156,86.7549, 27, 9999, 24, 9999, 34, 9999); // Lab
  138.  
  139.  
  140.  
  141.  
  142.     /// Parachutes in plane
  143.  
  144.     AddStaticPickup(371, 15, 319.3416, 1020.7169,1950.6696);
  145.  
  146.     AddStaticPickup(371, 15, 312.6138, 1020.7346,1950.6655);
  147.    
  148.     AddStaticVehicle(487,-1991.5511,101.1975,27.7094,85.5666,56,76); // heli1
  149.  
  150.     AddStaticVehicle(419,-2029.4258,157.3501,28.6333,178.6565,47,76); // esperanto1
  151.  
  152.     AddStaticVehicle(461,-1968.4341,111.1161,27.2721,0.0488,37,1); // pcj1
  153.  
  154.     AddStaticVehicle(581,-1977.4008,115.1169,27.2904,353.0768,66,1); // bf-1
  155.  
  156.     AddStaticVehicle(549,-1986.7366,137.6883,27.3076,0.8248,72,39); // tampa1
  157.  
  158.     AddStaticVehicle(566,-1988.5802,195.2709,27.3205,177.7690,30,8); // tahoma1
  159.  
  160.     AddStaticVehicle(587,-2011.0776,163.8762,27.3320,181.2359,40,1); // euros1
  161.  
  162.     AddStaticVehicle(492,-1995.1697,163.1170,27.3919,180.4255,77,26); // greenwood1
  163.  
  164.     AddStaticVehicle(529,-1995.0192,153.4520,27.2445,179.7857,42,42); // willard1
  165.  
  166.  
  167.  
  168.  
  169.  
  170.     gRoundTimer = SetTimer("DefenceWin", gRoundTime, 0);
  171.  
  172.  
  173.  
  174.     return 1;
  175.  
  176. }
  177.  
  178.  
  179.  
  180. //---------------------------------------------------------
  181.  
  182.  
  183.  
  184. public DefenceWin() {
  185.  
  186.     EndTheRound(DEFENCE_WIN);
  187.  
  188. }
  189.  
  190.  
  191.  
  192. //---------------------------------------------------------
  193.  
  194.  
  195.  
  196. public OnPlayerConnect(playerid)
  197.  
  198. {
  199.  
  200.     GameTextForPlayer(playerid,"~b~Jordan's Doherty Break-In",6000,9);
  201.  
  202.     SetPlayerColor(playerid, COLOR_YELLOW);
  203.  
  204.     SetTimerEx("SettingPlayerTeam",10,1,"d",playerid);
  205.  
  206.     return 1;
  207.  
  208. }
  209.  
  210.  
  211.  
  212. //---------------------------------------------------------
  213.  
  214.  
  215.  
  216. SetupPlayerForClassSelection(playerid)
  217.  
  218. {
  219.  
  220.     SetPlayerInterior(playerid,9);
  221.  
  222.     SetPlayerFacingAngle(playerid,0.0);
  223.  
  224.     SetPlayerPos(playerid,315.7802,972.0253,1961.8705);
  225.  
  226.     SetPlayerCameraPos(playerid,315.7802,975.0253,1961.8705);
  227.  
  228.     SetPlayerCameraLookAt(playerid,315.7802,972.0253,1961.8705);
  229.  
  230.     return;
  231.  
  232. }
  233.  
  234.  
  235.  
  236. //---------------------------------------------------------
  237.  
  238.  
  239.  
  240. SetPlayerTeamFromClass(playerid, classid) {
  241.  
  242.     if(classid == 0 || classid == 1) {
  243.  
  244.         gTeam[playerid] = TEAM_ATTACK;
  245.  
  246.     } else if(classid == 2 || classid == 3) {
  247.  
  248.         gTeam[playerid] = TEAM_DEFENCE;
  249.  
  250.     }
  251.  
  252. }
  253.  
  254.  
  255.  
  256. //---------------------------------------------------------
  257.  
  258.  
  259.  
  260. public OnPlayerRequestClass(playerid, classid)
  261.  
  262. {
  263.  
  264.     SetPlayerTeamFromClass(playerid, classid);
  265.  
  266.     SetupPlayerForClassSelection(playerid);
  267.  
  268.  
  269.  
  270.     gPlayerClass[playerid] = classid;
  271.  
  272.     switch (classid) {
  273.  
  274.         case 0, 1:
  275.  
  276.             {
  277.  
  278.                 GameTextForPlayer(playerid, "~r~Attack", 1000, 3);
  279.  
  280.             }
  281.  
  282.         case 2, 3:
  283.  
  284.             {
  285.  
  286.                 GameTextForPlayer(playerid, "~g~Defence", 1000, 3);
  287.  
  288.             }
  289.  
  290.     }
  291.  
  292.     return 1;
  293.  
  294. }
  295.  
  296.  
  297.  
  298. //---------------------------------------------------------
  299.  
  300.  
  301.  
  302. public OnPlayerSpawn(playerid)
  303.  
  304. {
  305.  
  306.     SetPlayerArmour(playerid, 100);
  307.  
  308.     SetPlayerToTeamColour(playerid);
  309.  
  310.     switch (gPlayerClass[playerid]) {
  311.  
  312.         case 0:
  313.  
  314.             {
  315.  
  316.                 gPlayerCheckpointStatus[playerid] = CHECKPOINT_PLANE;
  317.  
  318.                 SetPlayerCheckpoint(playerid,315.7353,1035.6589,1945.1191,5.0);
  319.  
  320.                 SetPlayerInterior(playerid,9);
  321.  
  322.                 GameTextForPlayer(playerid, "There's an ~y~ parachute at the end of the ramp", 2000, 3);
  323.  
  324.             }
  325.  
  326.         case 1:
  327.        
  328.             {
  329.            
  330.                 gPlayerCheckpointStatus[playerid] = CHECKPOINT_DOHERTY;
  331.                
  332.                 GameTextForPlayer(playerid, "Drive to the building and capture the checkpoint!", 11000, 1);
  333.                
  334.                 SetPlayerInterior(playerid,0);
  335.                
  336.             }
  337.            
  338.         case 2, 3:
  339.  
  340.             {
  341.  
  342.                 gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
  343.  
  344.                 GameTextForPlayer(playerid, "Defend the building. Dont let the Attackers past you!", 11000, 1);
  345.  
  346.                 SetPlayerInterior(playerid,0);
  347.  
  348.             }
  349.  
  350.     }
  351.  
  352.     return 1;
  353.  
  354. }
  355.  
  356.  
  357.  
  358. //---------------------------------------------------------
  359.  
  360.  
  361.  
  362. SetPlayerToTeamColour(playerid) {
  363.  
  364.     if(gTeam[playerid] == TEAM_ATTACK) {
  365.  
  366.         SetPlayerColor(playerid,COLOR_RED); // Red
  367.  
  368.     } else if(gTeam[playerid] == TEAM_DEFENCE) {
  369.  
  370.         SetPlayerColor(playerid,COLOR_GREEN); // Green
  371.  
  372.     }
  373.  
  374. }
  375.  
  376.  
  377.  
  378. //---------------------------------------------------------
  379.  
  380.  
  381.  
  382. public OnPlayerEnterCheckpoint(playerid) {
  383.  
  384.     switch (gPlayerCheckpointStatus[playerid]) {
  385.  
  386.         case CHECKPOINT_PLANE:
  387.  
  388.             {
  389.  
  390.                 GameTextForPlayer(playerid, "Now parachute to ~g~the Building.", 2000, 5);
  391.  
  392.                 SetPlayerInterior(playerid,0);
  393.  
  394.                 SetPlayerPos(playerid, -2048.0378, -48.1043, 712.5142);
  395.  
  396.                 SetPlayerCheckpoint(playerid, -2145.8447, -254.4387, 40.7195, 5.0);
  397.  
  398.                 gPlayerCheckpointStatus[playerid] = CHECKPOINT_DOHERTY;
  399.  
  400.             }
  401.  
  402.         case CHECKPOINT_DOHERTY:
  403.  
  404.             {
  405.  
  406.                 DisablePlayerCheckpoint(playerid);
  407.  
  408.                 gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
  409.  
  410.                 EndTheRound(ATTACK_WIN);
  411.  
  412.             }
  413.  
  414.         default:
  415.  
  416.             {
  417.  
  418.                 DisablePlayerCheckpoint(playerid);
  419.  
  420.             }
  421.  
  422.     }
  423.  
  424.     return 1;
  425.  
  426. }
  427.  
  428.  
  429.  
  430. //---------------------------------------------------------
  431.  
  432.  
  433.  
  434. public OnPlayerDeath(playerid, killerid, reason)
  435.  
  436. {
  437.  
  438.     if (killerid != INVALID_PLAYER_ID) {
  439.  
  440.  
  441.  
  442.         if (gTeam[playerid] == gTeam[killerid]) {
  443.  
  444.             SetPlayerScore(killerid, GetPlayerScore(killerid) - 1);
  445.  
  446.         }
  447.  
  448.         else {
  449.  
  450.             SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
  451.  
  452.         }
  453.  
  454.     }
  455.  
  456.     SendDeathMessage(killerid, playerid, reason);
  457.  
  458.  
  459.  
  460.     DisablePlayerCheckpoint(playerid);
  461.  
  462.     gPlayerCheckpointStatus[playerid] = CHECKPOINT_NONE;
  463.  
  464.  
  465.  
  466.     SetPlayerColor(playerid,COLOR_GREY);
  467.  
  468.     return 1;
  469.  
  470. }
  471.  
  472.  
  473.  
  474. //---------------------------------------------------------
  475.  
  476.  
  477.  
  478. EndTheRound(winner) {
  479.  
  480.     switch (winner) {
  481.  
  482.         case ATTACK_WIN:
  483.  
  484.         {
  485.  
  486.             GameTextForAll("Attackers Win!", 7000, 3);
  487.  
  488.             KillTimer(gRoundTimer);
  489.  
  490.         }
  491.  
  492.         case DEFENCE_WIN:
  493.  
  494.         {
  495.  
  496.             GameTextForAll("Defenders Win!", 7000, 3);
  497.            
  498.             SendClientMessageToAll(COLOR_GREEN, "10 minutes have passed");
  499.  
  500.         }
  501.  
  502.     }
  503.  
  504.     SetTimer("GameModeExitFunc", 5000, 0);
  505.  
  506. }
  507.  
  508.  
  509.  
  510. //---------------------------------------------------------
  511.  
  512.  
  513.  
  514. public GameModeExitFunc()
  515.  
  516. {
  517.  
  518.     GameModeExit();
  519.  
  520. }
  521.  
  522. public SettingPlayerTeam()
  523. {
  524.         for(new playerid; playerid < 200; playerid++)
  525.         SetPlayerTeam(playerid, gTeam[playerid]);
  526.         return 1;
  527. }
  528.  
  529. //------------------------------------------------------------
  530.  
  531. public OnPlayerCommandText(playerid, cmdtext[])
  532. {
  533.     if(strcmp("/help", cmdtext, true, 10) == 0)
  534.     {
  535.        SendClientMessage(playerid, blue, "Welcome to Doherty Break-In coded by [Xs]Jordan (on December 2008)");
  536.        SendClientMessage(playerid, blue, "type /objective to see what to do");
  537.        SendClientMessage(playerid, blue, "Or type /attack | /defend to switch from team");
  538.        return 1;
  539.     }
  540.     if(strcmp("/objective", cmdtext, true, 10) == 0)
  541.     {
  542.        SendClientMessage(playerid, COLOR_RED, "---------------Attackers--------------");
  543.        SendClientMessage(playerid, COLOR_RED, "As Attacker you gotta parachute to the building.");
  544.        SendClientMessage(playerid, COLOR_RED, "There's an parachute at the end of the range.");
  545.        SendClientMessage(playerid, COLOR_RED, "While you got the parachute, goto the building.");
  546.        SendClientMessage(playerid, COLOR_RED, "When your landed, run to the Checkpoint to win!");
  547.        SendClientMessage(playerid, COLOR_GREEN, "---------------Defenders---------------");
  548.        SendClientMessage(playerid, COLOR_GREEN, "Make sure the attackers DONT passed you.");
  549.        SendClientMessage(playerid, COLOR_GREEN, "You have to defend the Checkpoint (red maker)");
  550.        SendClientMessage(playerid, COLOR_GREEN, "You can kill the attackers with your guns ");
  551.        return 1;
  552.     }
  553.     if(strcmp("/attack", cmdtext, true, 10) == 0)
  554.     {
  555.        SetPlayerTeam(playerid, 2);
  556.        SetPlayerSkin(playerid, 113);
  557.        SendClientMessage(playerid, blue, "You have changed your team to 'Attackers'");
  558.        return 1;
  559.     }
  560.     if(strcmp("/defend", cmdtext, true, 10) == 0)
  561.     {
  562.        SetPlayerTeam(playerid, 3);
  563.        SetPlayerSkin(playerid, 287);
  564.        SendClientMessage(playerid, blue, "You have changed your team to 'Defenders'");
  565.        return 1;
  566.     }
  567.     return 0;
  568. }
Advertisement
Add Comment
Please, Sign In to add comment