Yossef_Jones

OnPlayerEnterCheckPoint

May 15th, 2013
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 11.62 KB | None | 0 0
  1. public OnPlayerEnterCheckpoint(playerid)
  2. {
  3.     if(DeliverMoney[playerid] == 1 && IsPlayerInRangeOfPoint(playerid, 10, -2227.4868,2327.0056,7.5469))
  4.     {
  5.         new Rob = BankRobber[playerid]-1, string[128];
  6.         DisablePlayerCheckpoint(playerid);
  7.         BankRobbersCount --;
  8.         format(BankRobbers[Rob], MAX_PLAYER_NAME, "");
  9.         DeliverMoney[playerid] = 0;
  10.         //
  11.         foreach(Player, i)
  12.         {
  13.             if(BankRobber[i] || PlayerInfo[i][pFac] == 1)
  14.             {
  15.                 if(Rob == 0) TextDrawHideForPlayer(i, Textdraw1);
  16.                 else if(Rob == 1) TextDrawHideForPlayer(i, Textdraw2);
  17.                 else if(Rob == 2) TextDrawHideForPlayer(i, Textdraw3);
  18.                 else if(Rob == 3) TextDrawHideForPlayer(i, Textdraw4);
  19.                 else if(Rob == 4) TextDrawHideForPlayer(i, Textdraw5);
  20.             }
  21.         }
  22.         GiveDodMoney(playerid, 10000);
  23.         format(string, sizeof(string), "** %s has delivered their stolen money and claimed $10,000. **", RPN(playerid));
  24.         SendRobberyMessage(COLOR_LIME, string);
  25.         SendCopMessage(COLOR_LIME, string);
  26.         BankRobber[playerid] = 0;
  27.         TotalStolen ++;
  28.         //
  29.         if(BankRobbersCount == 0)
  30.         {
  31.             TextDrawHideForAll(Textdraw0);
  32.             TextDrawHideForAll(Textdraw1);
  33.             TextDrawHideForAll(Textdraw2);
  34.             TextDrawHideForAll(Textdraw3);
  35.             TextDrawHideForAll(Textdraw4);
  36.             TextDrawHideForAll(Textdraw5);
  37. //          BankRobbery = 0;
  38.             RobberyStarted = 0;
  39.             format(string, sizeof(string), "** The bank robbery has ended, $%d were stolen and $%d were saved. **", TotalStolen*10000, (TotalRobbers*10000-(TotalStolen*10000)));
  40.             SendClientMessageToAll(COLOR_YELLOW, string);
  41.             TotalRobbers = 0;
  42.             new copsonline;
  43.             foreach(Player, i)
  44.             {
  45.                 if(IsACop(i)) copsonline++;
  46.             }
  47.             foreach(Player, i)
  48.             {
  49.                 if(IsACop(i))
  50.                 {
  51.                     new Saved = (TotalRobbers*10000-(TotalStolen*10000));
  52.                     GiveDodMoney(i, Saved/copsonline);
  53.                     format(string, sizeof(string), "** You have received your cut from the saved money. ($%d)", Saved/copsonline);
  54.                     SendClientMessage(i, COLOR_LIME, string);
  55.                 }
  56.             }
  57.         }
  58.     }
  59.     else if(CP[playerid] == 1337 && IsPlayerInRangeOfPoint(playerid,7.0,2696.0520,-2225.8101,13.2554)) //isplayerinrangeofpoint check is for a huge exploit fix - 6/15/10
  60.     {
  61.         new string[128];
  62.         if(IsPlayerInAnyVehicle(playerid))
  63.         {
  64.             PlayerInfo[playerid][pJackSkill] ++;
  65.             if(PlayerInfo[playerid][pJackSkill] == 50) { SendClientMessage(playerid, COLOR_YELLOW, "* Your Car Jack Skill is now Level 2, you will now earn more Money and have a quicker Reload Time."); }
  66.             else if(PlayerInfo[playerid][pJackSkill] == 100) { SendClientMessage(playerid, COLOR_YELLOW, "* Your Car Jack Skill is now Level 3, you will now earn more Money and have a quicker Reload Time."); }
  67.             else if(PlayerInfo[playerid][pJackSkill] == 200) { SendClientMessage(playerid, COLOR_YELLOW, "* Your Car Jack Skill is now Level 4, you will now earn more Money and have a quicker Reload Time."); }
  68.             else if(PlayerInfo[playerid][pJackSkill] == 400) { SendClientMessage(playerid, COLOR_YELLOW, "* Your Car Jack Skill is now Level 5, you will now earn more Money and have a quicker Reload Time."); }
  69.             if(DayRespect == 1)
  70.             {
  71.                    PlayerInfo[playerid][pJackSkill] ++;
  72.             }
  73.             new level = PlayerInfo[playerid][pJackSkill];
  74.             if(level >= 0 && level <= 49)
  75.             {
  76.                 new rand = random(sizeof(SELLCAR1));
  77.                 format(string, sizeof(string), "* You sold a car for $%d.", SELLCAR1[rand]);
  78.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  79.                 PlayerInfo[playerid][pMoney] = PlayerInfo[playerid][pMoney]+SELLCAR1[rand];
  80.                 GivePlayerMoney(playerid, SELLCAR1[rand]);
  81.             }
  82.             else if(level >= 50 && level <= 99)
  83.             {
  84.                 new rand = random(sizeof(SELLCAR2));
  85.                 format(string, sizeof(string), "* You sold a car for $%d.", SELLCAR2[rand]);
  86.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  87.                 PlayerInfo[playerid][pMoney] = PlayerInfo[playerid][pMoney]+SELLCAR2[rand];
  88.                 GivePlayerMoney(playerid, SELLCAR2[rand]);
  89.             }
  90.             else if(level >= 100 && level <= 199)
  91.             {
  92.                 new rand = random(sizeof(SELLCAR3));
  93.                 format(string, sizeof(string), "* You sold a car for $%d.", SELLCAR3[rand]);
  94.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  95.                 PlayerInfo[playerid][pMoney] = PlayerInfo[playerid][pMoney]+SELLCAR3[rand];
  96.                 GivePlayerMoney(playerid, SELLCAR3[rand]);
  97.             }
  98.             else if(level >= 200 && level <= 399)
  99.             {
  100.                 new rand = random(sizeof(SELLCAR4));
  101.                 format(string, sizeof(string), "* You sold a car for $%d.", SELLCAR4[rand]);
  102.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  103.                 PlayerInfo[playerid][pMoney] = PlayerInfo[playerid][pMoney]+SELLCAR4[rand];
  104.                 GivePlayerMoney(playerid, SELLCAR4[rand]);
  105.             }
  106.             else if(level >= 400)
  107.             {
  108.                 new money = 6000;
  109.                 format(string, sizeof(string), "* You sold a car for $%d.", money);
  110.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
  111.                 PlayerInfo[playerid][pMoney] = PlayerInfo[playerid][pMoney]+money;
  112.                 GivePlayerMoney(playerid, money);
  113.             }
  114.             GameTextForPlayer(playerid, "~y~Sold the car", 2500, 1);
  115.             CP[playerid] = 0;
  116.             DisablePlayerCheckpoint(playerid);
  117.             DestroyVehicle(GetPlayerVehicleID(playerid));
  118.         }
  119.         else GameTextForPlayer(playerid, "Not in a car", 5000, 1);
  120.     }
  121.     if(CP[playerid] == 2424)
  122.     {
  123.         new
  124.             andro = CreateVehicle(592, 1871.6700, -2285.5400, 714.2615, 270.0000, 1, 1, -1),
  125.             airport = random(2),
  126.             destination[24],
  127.             string[128],
  128.             Float:x, Float:y, Float:z;
  129.  
  130.         GetPlayerPos(playerid, x, y, z);
  131.         FlightPosition[playerid][0] = x;
  132.         FlightPosition[playerid][1] = y;
  133.         FlightPosition[playerid][2] = z;
  134.  
  135.         PutPlayerInVehicle(playerid, andro, 0);
  136.         FlightStarted[playerid] = 1;
  137.         switch (airport)
  138.         {
  139.             case 0:
  140.             {
  141.                 SetPlayerCheckpoint(playerid, -1462.8226, 30.5481, 14.1484, 15.0);
  142.                 destination = "San Fierro Airport";
  143.             }
  144.             case 1:
  145.             {
  146.                 SetPlayerCheckpoint(playerid, 1477.2936, 1664.1234, 10.8125, 15.0);
  147.                 destination = "Las Venturas Airport";
  148.             }
  149.         }
  150.         CP[playerid] = 2425;
  151.         format(string, sizeof(string), "* %s enters the plane and starts it up.", RPN(playerid));
  152.         SendClientMessage(playerid, COLOR_PURPLE, string);
  153.         SendClientMessage(playerid, COLOR_PURPLE, "* 20 minutes later, the passengers board the plane.");
  154.         format(string, sizeof(string), "Your destination is %s. Land the plane into the checkpoint on the runway.", destination);
  155.         SendClientMessage(playerid, COLOR_YELLOW, string);
  156.         return 1;
  157.     }
  158.     else if(CP[playerid] == 2425)
  159.     {
  160.         new string[128];
  161.         if (GetVehicleModel(GetPlayerVehicleID(playerid)) != 592) return SendClientMessage(playerid, COLOR_GREY, "Hold on there! Where's your plane?");
  162.         CP[playerid] = 0;
  163.         DisablePlayerCheckpoint(playerid);
  164.         format(string, sizeof(string), "* %s switches the landing gear off, announcing that the flight has arrived to it's destination.", RPN(playerid));
  165.         SendClientMessage(playerid, COLOR_PURPLE, string);
  166.         SendClientMessage(playerid, COLOR_YELLOW, "Please wait while the passengers get off the plane.");
  167.         SetTimerEx("GetOff", 30000, false, "d", playerid);
  168.         TogglePlayerControllable(playerid, 0);
  169.         new Float:x, Float:y, Float:z;
  170.         GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
  171.         SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
  172.         return 1;
  173.     }
  174.     else if(CP[playerid] == 2426)
  175.     {
  176.         if (GetVehicleModel(GetPlayerVehicleID(playerid)) != 592) return SendClientMessage(playerid, COLOR_GREY, "Hold on there! Where's your plane?");
  177.         DestroyVehicle(GetPlayerVehicleID(playerid));
  178.         GiveDodMoney(playerid, 12800);
  179.         FlightCooldown[playerid] = 1200;
  180.         SendClientMessage(playerid, COLOR_YELLOW, "You've received $12,800 for the mission. Good job.");
  181.         CP[playerid] = 0;
  182.         DisablePlayerCheckpoint(playerid);
  183.         FlightStarted[playerid] = 0;
  184.         return 1;
  185.     }
  186.     else if(CP[playerid] == 1997 && IsPlayerInRangeOfPoint(playerid,5,2696.0520,-2225.8101,13.2554)) // Car Jacker
  187.     {
  188.         new Float:Health;
  189.         GetVehicleHealth(GetPlayerVehicleID(playerid), Health);
  190.         //if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You are not in a car.");
  191.         //if (GetVehicleModel(GetPlayerVehicleID(playerid)) => 400) return SendClientMessage(playerid, COLOR_GREY, "You are not in a car.");
  192.        // if(IsPlayerInAnyVehicle(playerid))
  193.        // if(IsPlayerInRangeOfPoint(playerid,5,2696.0520,-2225.8101,13.2554)) // Car Jacker
  194.        // {
  195.         if(Health >= 900)
  196.         {
  197.             GiveDodMoney(playerid, 1200);
  198.             SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You've sold the car to the crane and gained $1200.");
  199.             SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  200.         }
  201.         else
  202.         {
  203.             GiveDodMoney(playerid, 500);
  204.             SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You've sold the car to the crane and gained $500.");
  205.             SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  206.         }
  207.         return 1;
  208.     }
  209.     if(CP[playerid] == 1) // Drivers License Test
  210.     {
  211.         if(IsPlayerInRangeOfPoint(playerid,5,980.1932,-1407.9902,13.0956)) // Checkpoint 1
  212.         {
  213.             SetPlayerCheckpoint(playerid,1009.3680,-1407.4510,13.0299,5);
  214.         }
  215.         else if(IsPlayerInRangeOfPoint(playerid,5,1009.3680,-1407.4510,13.0299)) // Checkpoint 2
  216.         {
  217.             SetPlayerCheckpoint(playerid,1035.6870,-1407.1594,13.1585,5);
  218.         }
  219.         else if(IsPlayerInRangeOfPoint(playerid,5,1035.6870,-1407.1594,13.1585)) // Checkpoint 3
  220.         {
  221.             SetPlayerCheckpoint(playerid,1058.1282,-1412.7396,13.3948,5);
  222.         }
  223.         else if(IsPlayerInRangeOfPoint(playerid,5,1058.1282,-1412.7396,13.3948)) // Checkpoint 4
  224.         {
  225.             SetPlayerCheckpoint(playerid,1059.2937,-1435.7738,13.3568,5);
  226.         }
  227.         else if(IsPlayerInRangeOfPoint(playerid,5,1059.2937,-1435.7738,13.3568)) // Checkpoint 5
  228.         {
  229.             SetPlayerCheckpoint(playerid,1056.1156,-1456.7148,13.3670,5);
  230.         }
  231.         else if(IsPlayerInRangeOfPoint(playerid,5,1056.1156,-1456.7148,13.3670)) // Checkpoint 6
  232.         {
  233.             SetPlayerCheckpoint(playerid,1012.2074,-1438.6262,13.5469,5);
  234.         }
  235.         else if(IsPlayerInRangeOfPoint(playerid,5,1012.2074,-1438.6262,13.5469)) // Checkpoint 7
  236.         {
  237.             SetPlayerCheckpoint(playerid,1026.7972,-1443.0872,13.5546,5);
  238.         }
  239.         else if(IsPlayerInRangeOfPoint(playerid,5,1026.7972,-1443.0872,13.5546)) // Checkpoint 8
  240.         {
  241.             SetPlayerCheckpoint(playerid,1026.6116,-1433.3167,13.5469,5);
  242.         }
  243.         else if(IsPlayerInRangeOfPoint(playerid,5,1026.6116,-1433.3167,13.5469)) // Checkpoint 9
  244.         {
  245.             SetPlayerCheckpoint(playerid,1004.7498,-1439.7341,13.5469,5);
  246.         }
  247.         else if(IsPlayerInRangeOfPoint(playerid,5,1004.7498,-1439.7341,13.5469)) // Checkpoint 10
  248.         {
  249.             SetPlayerCheckpoint(playerid,967.4974,-1443.5815,13.5041,5);
  250.         }
  251.         else if(IsPlayerInRangeOfPoint(playerid,5,967.4974,-1443.5815,13.5041)) // Checkpoint 12
  252.         {
  253.             new Float:Health;
  254.             GetVehicleHealth(GetPlayerVehicleID(playerid), Health);
  255.             if(Health > 900)
  256.             {
  257.                 DisablePlayerCheckpoint(playerid);
  258.                 PlayerInfo[playerid][pCarLic] = 1;
  259.                 LicenseTest[playerid] = 0;
  260.                 CP[playerid] = 0;
  261.                 SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  262.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Driving Center: You have successfully passed the test and received your license.");
  263.             }
  264.             else
  265.             {
  266.                 DisablePlayerCheckpoint(playerid);
  267.                 LicenseTest[playerid] = 0;
  268.                 CP[playerid] = 0;
  269.                 SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  270.                 SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Driving Center: You have damaged your vehicle hardly, therefore you failed the test.");
  271.             }
  272.         }
  273.     }
  274.     else DisablePlayerCheckpoint(playerid);
  275.     return 1;
  276. }
  277.  
  278. public OnPlayerLeaveCheckpoint(playerid)
  279. {
  280.     return 1;
  281. }
  282.  
  283. public OnPlayerEnterRaceCheckpoint(playerid)
  284. {
  285.     return 1;
  286. }
  287.  
  288. public OnPlayerLeaveRaceCheckpoint(playerid)
  289. {
  290.     return 1;
  291. }
Advertisement
Add Comment
Please, Sign In to add comment