a pastebin project

Paste Description for GTA: Bombing Run

GTA: Bombing Run By [xA]Ramjet

GTA: Bombing Run

  1. // GTA: BOMBING RUN By Ramjet
  2. // Based off LYSE coded by Jax.
  3. #include <a_samp>
  4. #include <core>
  5. #include <float>
  6.  
  7. #define MAX_PLAYERS 100
  8. #define INVALID_PLAYER_ID 100
  9.  
  10. #define COLOR_GREY 0xAFAFAFAA
  11. #define COLOR_GREEN 0x33AA33AA
  12. #define COLOR_RED 0xAA3333AA
  13. #define COLOR_YELLOW 0xFFFF00AA
  14. #define OBJECTIVE_COLOR 0xE2C063FF
  15. #define BALL_RESET_TIME 30000 // ms
  16.  
  17. forward SetPlayerToTeamColor(playerid);
  18. forward SetPlayerTeamFromClass(playerid,classid);
  19. forward SetPlayerRandomSpawn(playerid);
  20. forward ExitTheGameMode();
  21. forward SetupPlayerForClassSelection(playerid);
  22.  
  23.  
  24. static gTeam[MAX_PLAYERS]; // Tracks the team assignment for each player
  25.  
  26. #define OBJECTIVE_VEHICLE 1
  27. #define TEAM_BLUE 1  //tg
  28. #define TEAM_GREEN 2  //tb
  29. #define TEAM_BLUE_COLOR 0x0000FFAA
  30. #define TEAM_GREEN_COLOR 0x33AA33AA
  31.  
  32. #define GAME_ROUNDLIMIT 9
  33.  
  34. new gPlayerCar[MAX_PLAYERS]; // For Car Jacking Protection
  35. new gObjectiveBluePlayer=(-1);
  36. new gObjectiveGreenPlayer=(-1);
  37. new gObjectiveReached=0;
  38. new gGreenScore=0;
  39. new gBlueScore=0;
  40.  
  41. new Float:gTeam1RandomPlayerSpawns[5][3] = {
  42. {1898.4811,-1213.7422,18.3800},
  43. {1903.7275,-1183.4065,22.9972},
  44. {1906.9772,-1194.1093,21.5643},
  45. {1918.7587,-1176.0880,22.3803},
  46. {1923.9995,-1219.1479,19.5952}
  47. };
  48.  
  49. new Float:gTeam2RandomPlayerSpawns[5][3] = {
  50. {2015.3528,-1173.7057,21.7366},
  51. {2034.3434,-1190.3647,22.4699},
  52. {2036.5083,-1206.1500,22.6308},
  53. {2015.8668,-1217.2856,20.9440},
  54. {2019.4512,-1196.3738,20.5045}
  55. };
  56.  
  57.  
  58. main()
  59. {
  60.         print("\nÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
  61.         print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²");
  62.         print("±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");
  63.         print("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");
  64.         print("\n                   Å   GTA: Bombing Run   Å                   ");
  65.         print("\n°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°");
  66.         print("±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±");
  67.         print("²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²");
  68.         print("ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
  69. }
  70.  
  71. public OnPlayerStateChange(playerid, newstate, oldstate)
  72. {
  73.         new vehicleid;
  74.  
  75.         if(newstate == PLAYER_STATE_DRIVER)
  76.         {
  77.                 vehicleid = GetPlayerVehicleID(playerid);
  78.  
  79.                 if(gTeam[playerid] == TEAM_GREEN && vehicleid == OBJECTIVE_VEHICLE)
  80.                 { // It's the objective vehicle
  81.                     SetPlayerColor(playerid,OBJECTIVE_COLOR);
  82.                     GameTextForAll("~g~Green Team Has The Ball!",5000,5);
  83.                     gObjectiveBluePlayer = playerid;
  84.                     SetPlayerCheckpoint(playerid,2048.3293,-1194.6172,23.6734,7.0);
  85.   }
  86.  
  87.                 if(gTeam[playerid] == TEAM_BLUE && vehicleid == OBJECTIVE_VEHICLE)
  88.                 { // It's the objective vehicle
  89.                     SetPlayerColor(playerid,OBJECTIVE_COLOR);
  90.           GameTextForPlayer(playerid,"~b~Blue Team Has The Ball!",5000,5);
  91.                     gObjectiveGreenPlayer = playerid;
  92.                     SetPlayerCheckpoint(playerid,1885.1376,-1204.1265,19.6797,7.0);
  93.                 }
  94.         }
  95.         else if(newstate == PLAYER_STATE_ONFOOT)
  96.         {
  97.                 if(playerid == gObjectiveBluePlayer) {
  98.                     gObjectiveBluePlayer = (-1);
  99.                     SetPlayerToTeamColor(playerid);
  100.                     DisablePlayerCheckpoint(playerid);
  101.                 }
  102.  
  103.                 if(playerid == gObjectiveGreenPlayer) {
  104.                     gObjectiveGreenPlayer = (-1);
  105.                     SetPlayerToTeamColor(playerid);
  106.                     DisablePlayerCheckpoint(playerid);
  107.                 }
  108.         }
  109.         switch (newstate) {
  110.  
  111.                 case PLAYER_STATE_ONFOOT:
  112.                 {
  113.                         gPlayerCar[playerid] = -1;
  114.                 }
  115.                 case PLAYER_STATE_DRIVER:
  116.                 {
  117.                         gPlayerCar[playerid] = GetPlayerVehicleID(playerid);
  118.                         for(new i=0; i<MAX_PLAYERS; i++) {
  119.                                 if (gPlayerCar[playerid] == gPlayerCar[i] && playerid != i) {
  120.                                         RemovePlayerFromVehicle(i);
  121.                                         GameTextForPlayer(i,"~r~You Got Jacked!!!",4000,1);
  122.                                 }
  123.                         }
  124.                 }
  125.  
  126.         }
  127.  
  128.         return 1;
  129. }
  130.  
  131. public SetPlayerTeamFromClass(playerid,classid)
  132. {
  133.         // Set their team number based on the class they selected.
  134.         if(classid == 0 || classid == 1) {
  135.                 gTeam[playerid] = TEAM_GREEN;
  136.         } else if(classid == 2 || classid == 3) {
  137.             gTeam[playerid] = TEAM_BLUE;
  138.         }
  139. }
  140.  
  141. public SetPlayerToTeamColor(playerid)
  142. {
  143.         if(gTeam[playerid] == TEAM_BLUE) {
  144.                 SetPlayerColor(playerid,TEAM_BLUE_COLOR); // blue
  145.         } else if(gTeam[playerid] == TEAM_GREEN) {
  146.             SetPlayerColor(playerid,TEAM_GREEN_COLOR); // green
  147.         }
  148. }
  149.  
  150. public OnGameModeExit()
  151. {
  152.         print("GameModeExit()");
  153.         return 1;
  154. }
  155.  
  156. public OnPlayerConnect(playerid)
  157. {
  158.         GameTextForPlayer(playerid,"~w~SA-MP:~g~GTA~w~:~r~Bombing Run",4000,5);
  159.         SendPlayerFormattedText(playerid, "Welcome to GTA: Bombing Run, for help type /help.", 0);
  160.         GivePlayerMoney(playerid, 500);
  161.         return 1;
  162. }
  163.  
  164.  
  165. public OnPlayerCommandText(playerid, cmdtext[])
  166. {
  167.         new cmd[256];
  168.         new idx;
  169.  
  170.         cmd = strtok(cmdtext, idx);
  171.  
  172.         if(strcmp(cmd, "/help", true) == 0) {
  173.                 SendPlayerFormattedText(playerid,"GTA:Bombing Run Coded By [xA]Ramjet and the SA-MP Team.",0);
  174.                 SendPlayerFormattedText(playerid,"Type: /objective : to find out what to do in this gamemode.",0);
  175.                 SendPlayerFormattedText(playerid,"Type: /taunt : to send taunts to people.",0);
  176.     return 1;
  177.         }
  178.         if(strcmp(cmd, "/objective", true) == 0) {
  179.                 SendPlayerFormattedText(playerid,"The Objective of this gamemode is to steal the ball, which in",0);
  180.                 SendPlayerFormattedText(playerid,"this particular gamemode is a Bike. The first team to capture,",0);
  181.                 SendPlayerFormattedText(playerid,"the bike ten times wins.",0);
  182.     return 1;
  183.         }
  184.         if(strcmp(cmd, "/taunt", true) == 0) {
  185.                 SendPlayerFormattedText(playerid,"1 - And Stay Down",0);
  186.                 SendPlayerFormattedText(playerid,"2 - Anyone Else Want Some?,",0);
  187.                 SendPlayerFormattedText(playerid,"3 - Burn BABY",0);
  188.                 SendPlayerFormattedText(playerid,"4 - BOOM!",0);
  189.                 SendPlayerFormattedText(playerid,"5 - Die Bitch",0);
  190.                 SendPlayerFormattedText(playerid,"6 - Duck Faster Next Time",0);
  191.                 SendPlayerFormattedText(playerid,"7 - Eat THAT",0);
  192.                 SendPlayerFormattedText(playerid,"8 - Hold Still Damnit",0);
  193.                 SendPlayerFormattedText(playerid,"9 - Holy Shit",0);
  194.  
  195.     return 1;
  196.         }
  197.  
  198.         return 0;
  199. }
  200.  
  201. public OnPlayerSpawn(playerid)
  202. {
  203.  
  204.         SetPlayerToTeamColor(playerid);
  205.         SetVehicleParamsForPlayer(OBJECTIVE_VEHICLE,playerid,1,0);
  206.         SetPlayerWorldBounds(playerid,2061.1836,1857.3367,-1141.2140,-1255.8501);
  207.         GameTextForPlayer(playerid,"Capture The Bike And Put In In Goals",6000,5);
  208.         if(gTeam[playerid] == TEAM_BLUE) {
  209.                 SetPlayerRandomSpawn(playerid);
  210.         }
  211.         else if(gTeam[playerid] == TEAM_GREEN) {
  212.                 SetPlayerRandomSpawn(playerid);
  213.         }
  214.         SetPlayerInterior(playerid,0);
  215.  
  216.         return 1;
  217. }
  218.  
  219. public OnPlayerEnterCheckpoint(playerid)
  220. {
  221.         new playervehicleid = GetPlayerVehicleID(playerid);
  222.  
  223.         if(gObjectiveReached) return;
  224.  
  225.         if(playervehicleid == OBJECTIVE_VEHICLE && gTeam[playerid] == TEAM_BLUE)
  226.         {   // Green OBJECTIVE REACHED.
  227.                 GameTextForAll("~b~Blue ~w~team has ~r~Scored~w~!!!",5000,5);
  228.                 gObjectiveReached = 1;
  229.                 SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
  230.                
  231.                 if (gBlueScore < GAME_ROUNDLIMIT)  {
  232.                 gBlueScore++;
  233.                     RemovePlayerFromVehicle(playerid);
  234.                 SetPlayerColor(playerid, TEAM_BLUE_COLOR);
  235.                 SetVehicleToRespawn(OBJECTIVE_VEHICLE);
  236.                 gObjectiveReached = 0;
  237.                 }
  238.                 else if (gBlueScore == GAME_ROUNDLIMIT)  {
  239.                         SetTimer("ExitTheGameMode", 4000, 0); // Set up a timer to exit this mode.
  240.                         }
  241.                 return;
  242.         }
  243.         else if(playervehicleid == OBJECTIVE_VEHICLE && gTeam[playerid] == TEAM_GREEN)
  244.         {   // Blue OBJECTIVE REACHED.
  245.         GameTextForAll("~g~Green ~w~team has ~r~Scored~w~!!!",5000,5);
  246.             gObjectiveReached = 1;
  247.             SetPlayerScore(playerid,GetPlayerScore(playerid)+5);
  248.             
  249.             if (gGreenScore < GAME_ROUNDLIMIT)  {
  250.                 gGreenScore++;
  251.                 RemovePlayerFromVehicle(playerid);
  252.                 SetPlayerColor(playerid, TEAM_GREEN_COLOR);
  253.                 SetVehicleToRespawn(OBJECTIVE_VEHICLE);
  254.                 gObjectiveReached = 0;
  255.                 }
  256.                 else if (gGreenScore == GAME_ROUNDLIMIT)  {
  257.                         SetTimer("ExitTheGameMode", 4000, 0); // Set up a timer to exit this mode.
  258.                         }
  259.             return;
  260.         }
  261. }
  262.  
  263. public ExitTheGameMode()
  264. {
  265.     GameModeExit();
  266. }
  267.  
  268. public SetPlayerRandomSpawn(playerid)
  269. {
  270.  
  271.         if(gTeam[playerid] == TEAM_GREEN) {
  272.                 new rand = random(sizeof(gTeam1RandomPlayerSpawns));
  273.                 SetPlayerPos(playerid, gTeam1RandomPlayerSpawns[rand][0], gTeam1RandomPlayerSpawns[rand][1], gTeam1RandomPlayerSpawns[rand][2]); // Warp the player
  274.                 }
  275.         else if(gTeam[playerid] == TEAM_BLUE) {
  276.                 new rand = random(sizeof(gTeam2RandomPlayerSpawns));
  277.                 SetPlayerPos(playerid, gTeam2RandomPlayerSpawns[rand][0], gTeam2RandomPlayerSpawns[rand][1], gTeam2RandomPlayerSpawns[rand][2]); // Warp the player
  278.                 }
  279.         return 1;
  280. }
  281.  
  282.  
  283. //------------------------------------------------------------------------------------------------------
  284.  
  285. public OnPlayerDeath(playerid, killerid, reason)
  286. {
  287.         SendDeathMessage(killerid,playerid,reason);
  288.         if(killerid == INVALID_PLAYER_ID) {
  289.         SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
  290.         } else {
  291.         if(gTeam[killerid] != gTeam[playerid]) {
  292.                 // Valid kill
  293.                 SendDeathMessage(killerid,playerid,reason);
  294.                         SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  295.         }
  296.                 else {
  297.                     // Team kill
  298.                     SendDeathMessage(killerid,playerid,reason);
  299.                     SetPlayerHealth(killerid, 0.0);
  300.                         SendClientMessage(killerid, COLOR_RED, "You Have Been Punished For Teamkilling!!!");
  301.                 }
  302.         }
  303.         return 1;
  304. }
  305.  
  306. //------------------------------------------------------------------------------------------------------
  307. public OnPlayerText(playerid, text[])
  308. {
  309.  
  310.         switch (text[0]){
  311.                 case '1':{
  312.                 GameTextForAll("~r~And Stay Down!", 2000, 4);
  313.                 return 0;
  314.                 }
  315.                 case '2':{
  316.                 GameTextForAll("~r~Anyone Else Want Some?", 2000, 4);
  317.                 return 0;
  318.                 }
  319.                 case '3':{
  320.                 GameTextForAll("~r~Burn BABY", 2000, 4);
  321.                 return 0;
  322.                 }
  323.                 case '4':{
  324.                 GameTextForAll("~r~BOOM!", 2000, 4);
  325.                 return 0;
  326.                 }
  327.                 case '5':{
  328.                 GameTextForAll("~r~Die Bitch", 2000, 4);
  329.                 return 0;
  330.                 }
  331.                 case '6':{
  332.                 GameTextForAll("~r~Duck Faster Next Time", 2000, 4);
  333.                 return 0;
  334.                 }
  335.                 case '7':{
  336.                 GameTextForAll("~r~Eat That", 2000, 4);
  337.                 return 0;
  338.                 }
  339.                 case '8':{
  340.                 GameTextForAll("~r~Hold Still Damnit", 2000, 4);
  341.                 return 0;
  342.                 }
  343.                 case '9':{
  344.                 GameTextForAll("~r~Holy Shit", 2000, 4);
  345.                 return 0;
  346.                 }
  347.           }
  348.    return 1;
  349. }
  350. //------------------------------------------------------------------------------------------------------
  351. public SetupPlayerForClassSelection(playerid)
  352. {
  353.         SetPlayerPos(playerid,1969.4491,-1157.4449,20.9622);
  354.         SetPlayerFacingAngle(playerid, 92.3617);
  355.         SetPlayerCameraPos(playerid,1963.7303,-1157.4513,20.9621);
  356.         SetPlayerCameraLookAt(playerid,1969.4491,-1157.4449,20.9622);
  357. }
  358.  
  359. public OnPlayerRequestClass(playerid, classid)
  360. {
  361.         SetupPlayerForClassSelection(playerid);
  362.         SetPlayerTeamFromClass(playerid,classid);
  363.  
  364.         if(classid == 0 || classid == 1) {
  365.                 GameTextForPlayer(playerid,"~g~GREEN ~w~TEAM",1000,5);
  366.         } else if(classid == 2 || classid == 3) {
  367.             GameTextForPlayer(playerid,"~b~BLUE ~w~TEAM",1000,5);
  368.         }
  369.  
  370.         return 1;
  371. }
  372.  
  373. public OnGameModeInit()
  374. {
  375.         SetGameModeText("GTA: Bombing Run!");
  376.  
  377.         ShowPlayerMarkers(1);
  378.         ShowNameTags(1);
  379.  
  380.         // Player Class's
  381.         AddPlayerClass(45,1958.3783,1343.1572,15.3746,269.1425,0,0,31,400,29,400);
  382.         AddPlayerClass(101,1958.3783,1343.1572,15.3746,269.1425,0,0,31,400,29,400);
  383.         AddPlayerClass(44,1958.3783,1343.1572,15.3746,269.1425,0,0,31,400,29,400);
  384.         AddPlayerClass(79,1958.3783,1343.1572,15.3746,269.1425,0,0,31,400,29,400);
  385.  
  386.         //The Ball
  387.         AddStaticVehicle(509,1969.6045,-1188.2485,25.3040,183.7018,3,0);
  388.        
  389.         return 1;
  390. }
  391.  
  392. public SendPlayerFormattedText(playerid, const str[], define)
  393. {
  394.         new tmpbuf[256];
  395.         format(tmpbuf, sizeof(tmpbuf), str, define);
  396.         SendClientMessage(playerid, 0xFFFF00AA, tmpbuf);
  397. }
  398.  
  399. public SendAllFormattedText(playerid, const str[], define)
  400. {
  401.         new tmpbuf[256];
  402.         format(tmpbuf, sizeof(tmpbuf), str, define);
  403.         SendClientMessageToAll(0xFFFF00AA, tmpbuf);
  404. }
  405.  
  406. strtok(const string[], &index)
  407. {
  408.         new length = strlen(string);
  409.         while ((index < length) && (string[index] <= ' '))
  410.         {
  411.                 index++;
  412.         }
  413.  
  414.         new offset = index;
  415.         new result[20];
  416.         while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  417.         {
  418.                 result[index - offset] = string[index];
  419.                 index++;
  420.         }
  421.         result[index - offset] = EOS;
  422.         return result;
  423. }

advertising

Create a Paste

Please enter your new post below (or upload a file instead):





Please note that information posted here will not expire by default. If you want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords.

worth-right
fantasy-obligation fantasy-obligation