Advertisement
Adil_z

[NPC]LS Bus System

Aug 10th, 2011
3,620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 25.01 KB | None | 0 0
  1. //Note
  2. /*This is a [NPC]Filterscript  made by Adil.
  3.   This Filter script allows you to travel through LS with two [NPC]'s who drive the Bus.
  4.   I basically made this for RP servers.
  5.   If you are facing some problems then read the tutorial or post your problem on the release page.
  6.   Please you are requested to not to remove the credits, thankyou.
  7.   For further support, this is my forums profile http://forum.sa-mp.com/member.php?u=35249
  8.   Enjoy.*/
  9.  
  10. //Includes
  11. #include <a_samp>
  12.  
  13. //Defines
  14. #define COLOR_WHITE 0xFFFFFFFF
  15. #define COLOR_RED 0xFF0000FF
  16. #define COLOR_PURPLE 0xC2A2DAAA
  17. #define COLOR_TEAL 0x00AAAAAA
  18. #define COLOR_OFFWHITE 0xF5DEB3AA
  19. #define COLOR_DARKAQUA 0x83BFBFAA
  20.  
  21. //News
  22. new Text3D:NPCTextBlue;
  23. new Text3D:NPCTextBlack;
  24. new NPCBlueBus;
  25. new NPCBlackBus;
  26. new BusID[MAX_PLAYERS];
  27. new BusCost[MAX_PLAYERS];
  28. new PlayerSitting[MAX_PLAYERS];
  29. new Float:Playerx[MAX_PLAYERS], Float:Playery[MAX_PLAYERS], Float:Playerz[MAX_PLAYERS], Float:Playera[MAX_PLAYERS], PlayerSkin[MAX_PLAYERS];
  30. new costtimer;
  31.  
  32. //Forwards
  33. forward IsAtBlueBusStop(playerid);
  34. forward IsAtBlackBusStop(playerid);
  35. forward ResetView(playerid);
  36. forward CPOff(playerid);
  37. forward CostTimer(playerid);
  38. forward ProxDetector(Float:radi, playerid, string[], color1, color2, color3, color4, color5);
  39.  
  40. //Publics
  41. public OnFilterScriptInit()
  42. {
  43.     print("                                ");
  44.     print("\n--------------------------------");
  45.     print("  Adil's [NPC]LS Bus System.");
  46.     print("--------------------------------\n");
  47.     print("                                ");
  48.    
  49.     //NPCs
  50.     ConnectNPC("BlueBusDriver","Bus");
  51.     ConnectNPC("BlackBusDriver","Bus2");
  52.    
  53.     //3DTextLabels
  54.     NPCTextBlue = Create3DTextLabel("Blue Bus", 0x6495EDFF, 0.0, 0.0, 0.0, 30.0,0, 0);
  55.     NPCTextBlack = Create3DTextLabel("Black Bus", 0x6495EDFF, 0.0, 0.0, 0.0, 30.0,0, 0);
  56.     Create3DTextLabel("Press F to Exit", 0x6495EDFF, 2021.9740,2235.6626,2103.9536, 15.0,2);
  57.     Create3DTextLabel("Press F to Exit", 0x6495EDFF, 2021.9740,2235.6626,2103.9536, 15.0,3);
  58.    
  59.     //Vehicles
  60.     NPCBlueBus = CreateVehicle(431, 0.0, 0.0, 0.0, 0.0, 125, 125, 1);
  61.     NPCBlackBus = CreateVehicle(431, 0.0, 0.0, 0.0, 0.0, 0, 0, 1);
  62.    
  63.     //Objects
  64.     CreateObject(1257, 2868.9033203125, -1416.40625, 11.013171195984, 0, 0, 179.99450683594);//Bus Stops
  65.     CreateObject(1257, 2636.32421875, -1693.125, 10.954420089722, 0, 0, 179.99450683594);
  66.     CreateObject(1257, 2649.0073242188, -1710.6044921875, 11.185441970825, 0, 0, 0);
  67.     CreateObject(1257, 2243.845703125, -1725.912109375, 13.596067428589, 0, 0, 90);
  68.     CreateObject(1257, 2252.8876953125, -1738.87109375, 13.62606716156, 0, 0, 270);
  69.     CreateObject(1257, 1948.3310546875, -1454.3525390625, 13.596067428589, 0, 0, 90);
  70.     CreateObject(1257, 1926.419921875, -1472.359375, 13.62606716156, 0, 0, 270);
  71.     CreateObject(1257, 1571.064453125, -2188.0107421875, 13.62606716156, 0, 0, 90);
  72.     CreateObject(1257, 1712.9423828125, -1818.71484375, 13.62606716156, 0, 0, 270);
  73.     CreateObject(1257, 1567.0966796875, -1725.4755859375, 13.62606716156, 0, 0, 90);
  74.     CreateObject(1257, 1544.9990234375, -1739.0458984375, 13.62606716156, 0, 0, 270);
  75.     CreateObject(1257, 1503.9716796875, -1027.76171875, 23.770128250122, 0, 0, 83.995971679688);
  76.     CreateObject(1257, 1440.32421875, -1040.7060546875, 23.907316207886, 0, 0, 270);
  77.     CreateObject(1257, 1188.8359375, -1354.6279296875, 13.648303985596, 0, 0, 179.99450683594);
  78.     CreateObject(1257, 1212.8427734375, -1327.83984375, 13.647026062012, 0, 0, 0);
  79.     CreateObject(1257, 861.71252441406, -1313.3009033203, 13.626066970825, 0, 0, 90);
  80.     CreateObject(1257, 850.67578125, -1333.970703125, 13.615329742432, 0, 0, 270);
  81.     CreateObject(1257, 393.69442749023, -1766.2702636719, 5.6197347640991, 0, 0, 90);
  82.     CreateObject(1257, 1705.58984375, -1805.84765625, 13.530066490173, 0, 0, 90);//
  83.     CreateObject(2631, 2022.0, 2236.7, 2102.9, 0.0, 0.0, 90.0);//Bus Interior
  84.     CreateObject(2631, 2022.0, 2240.6, 2102.9, 0.0, 0.0, 90.0);
  85.     CreateObject(2631, 2022.0, 2244.5, 2102.9, 0.0, 0.0, 90.0);
  86.     CreateObject(2631, 2022.0, 2248.4, 2102.9, 0.0, 0.0, 90.0);
  87.     CreateObject(16501, 2022.1, 2238.3, 2102.8, 0.0, 90.0, 0.0);
  88.     CreateObject(16501, 2022.1, 2245.3, 2102.8, 0.0, 90.0, 0.0);
  89.     CreateObject(16000, 2024.2, 2240.1, 2101.2, 0.0, 0.0, 90.0);
  90.     CreateObject(16000, 2019.8, 2240.6, 2101.2, 0.0, 0.0, -90.0);
  91.     CreateObject(16000, 2022.2, 2248.7, 2101.2, 0.0, 0.0, 180.0);
  92.     CreateObject(16501, 2021.8, 2246.5, 2107.3, 0.0, 270.0, 90.0);
  93.     CreateObject(16501, 2022.0, 2240.8, 2107.3, 0.0, 270.0, 0.0);
  94.     CreateObject(16501, 2022.0, 2233.7, 2107.3, 0.0, 270.0, 0.0);
  95.     CreateObject(18098, 2024.3, 2239.6, 2104.8, 0.0, 0.0, 90.0);
  96.     CreateObject(18098, 2024.3, 2239.7, 2104.7, 0.0, 0.0, 450.0);
  97.     CreateObject(18098, 2020.1, 2239.6, 2104.8, 0.0, 0.0, 90.0);
  98.     CreateObject(18098, 2020.0, 2239.6, 2104.7, 0.0, 0.0, 90.0);
  99.     CreateObject(2180, 2023.6, 2236.1, 2106.7, 0.0, 180.0, 90.0);
  100.     CreateObject(2180, 2023.6, 2238.1, 2106.7, 0.0, 180.0, 90.0);
  101.     CreateObject(2180, 2023.6, 2240.1, 2106.7, 0.0, 180.0, 90.0);
  102.     CreateObject(2180, 2023.6, 2242.1, 2106.7, 0.0, 180.0, 90.0);
  103.     CreateObject(2180, 2023.6, 2244.1, 2106.7, 0.0, 180.0, 90.0);
  104.     CreateObject(2180, 2023.6, 2246.1, 2106.7, 0.0, 180.0, 90.0);
  105.     CreateObject(2180, 2023.6, 2248.1, 2106.7, 0.0, 180.0, 90.0);
  106.     CreateObject(2180, 2020.3, 2235.1, 2106.7, 0.0, 180.0, 270.0);
  107.     CreateObject(2180, 2020.3, 2237.1, 2106.7, 0.0, 180.0, 270.0);
  108.     CreateObject(2180, 2020.3, 2239.1, 2106.7, 0.0, 180.0, 270.0);
  109.     CreateObject(2180, 2020.3, 2241.1, 2106.7, 0.0, 180.0, 270.0);
  110.     CreateObject(2180, 2020.3, 2243.1, 2106.7, 0.0, 180.0, 270.0);
  111.     CreateObject(2180, 2020.3, 2245.1, 2106.7, 0.0, 180.0, 270.0);
  112.     CreateObject(2674, 2023.4, 2238.3, 2102.9, 0.0, 0.0, 600.0);
  113.     CreateObject(2674, 2020.4, 2242.3, 2102.9, 0.0, 0.0, 600.0);
  114.     CreateObject(2674, 2023.4, 2246.3, 2102.9, 0.0, 0.0, 600.0);
  115.     CreateObject(14405, 2022.0, 2242.1, 2103.5, 0.0, 0.0, 540.0);
  116.     CreateObject(14405, 2022.0, 2243.6, 2103.5, 0.0, 0.0, 180.0);
  117.     CreateObject(14405, 2022.0, 2245.1, 2103.5, 0.0, 0.0, 180.0);
  118.     CreateObject(14405, 2022.0, 2246.6, 2103.5, 0.0, 0.0, 180.0);
  119.     CreateObject(14405, 2022.0, 2248.1, 2103.5, 0.0, 0.0, 180.0);
  120.     CreateObject(14405, 2022.0, 2249.6, 2103.5, 0.0, 0.0, 180.0);
  121.     CreateObject(14405, 2022.0, 2251.1, 2103.5, 0.0, 0.0, 180.0);
  122.     CreateObject(14405, 2024.6, 2242.1, 2103.5, 0.0, 0.0, 180.0);
  123.     CreateObject(14405, 2024.6, 2243.6, 2103.5, 0.0, 0.0, 180.0);
  124.     CreateObject(14405, 2024.6, 2245.1, 2103.5, 0.0, 0.0, 180.0);
  125.     CreateObject(14405, 2024.6, 2246.6, 2103.5, 0.0, 0.0, 180.0);
  126.     CreateObject(14405, 2024.6, 2248.1, 2103.5, 0.0, 0.0, 180.0);
  127.     CreateObject(14405, 2024.6, 2249.6, 2103.5, 0.0, 0.0, 180.0);
  128.     CreateObject(14405, 2024.6, 2251.1, 2103.5, 0.0, 0.0, 180.0);
  129.     CreateObject(14405, 2019.4, 2242.1, 2103.5, 0.0, 0.0, 180.0);
  130.     CreateObject(14405, 2019.4, 2243.6, 2103.5, 0.0, 0.0, 180.0);
  131.     CreateObject(14405, 2019.4, 2245.1, 2103.5, 0.0, 0.0, 180.0);
  132.     CreateObject(14405, 2019.4, 2246.6, 2103.5, 0.0, 0.0, 180.0);
  133.     CreateObject(14405, 2019.4, 2248.1, 2103.5, 0.0, 0.0, 180.0);
  134.     CreateObject(14405, 2019.4, 2249.6, 2103.5, 0.0, 0.0, 180.0);
  135.     CreateObject(14405, 2019.4, 2251.1, 2103.5, 0.0, 0.0, 180.0);
  136.     CreateObject(14405, 2022.0, 2253.6, 2104.0, -6.0, 0.0, 180.0);
  137.     CreateObject(14405, 2021.1, 2253.6, 2104.0, -6.0, 0.0, 180.0);
  138.     CreateObject(14405, 2024.6, 2253.6, 2103.5, 0.0, 0.0, 180.0);
  139.     CreateObject(2674, 2020.4, 2235.7, 2102.9, 0.0, 0.0, 52.0);
  140.     CreateObject(2673, 2020.4, 2246.7, 2102.9, 0.0, 0.0, 270.0);
  141.     CreateObject(2700, 2023.5, 2235.1, 2105.5, 180.0, -4.0, 90.0);
  142.     CreateObject(2700, 2020.4, 2235.1, 2105.5, 180.0, 0.0, 90.0);
  143.     CreateObject(2700, 2023.5, 2242.1, 2105.5, 180.0, -4.0, 90.0);
  144.     CreateObject(2700, 2020.4, 2242.1, 2105.5, 180.0, 0.0, 90.0);
  145.     CreateObject(1799, 2023.1, 2234.2, 2105.7, 270.0, 0.0, 360.0);
  146.     CreateObject(1799, 2019.8, 2234.2, 2105.7, 270.0, 0.0, 0.0);
  147.     CreateObject(1538, 2022.7, 2234.7, 2102.8, 0.0, 0.0, 180.0);
  148.     CreateObject(1799, 2022.1, 2234.2, 2106.1, 720.0, 90.0, 450.0);
  149.     CreateObject(1799, 2021.8, 2234.2, 2105.1, 0.0, 270.0, 270.0);
  150.     CreateObject(1799, 2022.1, 2234.2, 2107.3, 0.0, 90.0, 90.0);
  151.     CreateObject(1799, 2021.6, 2234.2, 2106.3, 0.0, 270.0, 270.0);
  152.     CreateObject(1799, 2022.3, 2234.2, 2104.3, 90.0, 0.0, 180.0);//
  153.     return 1;
  154. }
  155.  
  156. public OnFilterScriptExit()
  157. {
  158.     return 1;
  159. }
  160.  
  161. public OnPlayerConnect(playerid)
  162. {
  163.     BusID[playerid] = 0;
  164.     BusCost[playerid] = 0;
  165.     PlayerSitting[playerid] = 0;
  166.     return 1;
  167. }
  168.  
  169. public OnPlayerSpawn(playerid)
  170. {
  171.     if(IsPlayerNPC(playerid))
  172.     {
  173.         new npcname[MAX_PLAYER_NAME];
  174.         GetPlayerName(playerid, npcname, sizeof(npcname));
  175.         if(!strcmp(npcname, "BlueBusDriver", true))
  176.         {
  177.             SetPlayerColor(playerid, 0xFFFFFF00);
  178.         PutPlayerInVehicle(playerid, NPCBlueBus, 0);
  179.             SetPlayerSkin(playerid, 255);
  180.             ResetPlayerWeapons(playerid);
  181.             Attach3DTextLabelToVehicle(NPCTextBlue, NPCBlueBus, 0.0, 0.0, 0.0);
  182.         }
  183.         if(!strcmp(npcname, "BlackBusDriver", true))
  184.         {
  185.             SetPlayerColor(playerid, 0xFFFFFF00);
  186.         PutPlayerInVehicle(playerid, NPCBlackBus, 0);
  187.             SetPlayerSkin(playerid, 255);
  188.             ResetPlayerWeapons(playerid);
  189.             Attach3DTextLabelToVehicle(NPCTextBlack, NPCBlackBus, 0.0, 0.0, 0.0);
  190.         }
  191.         return 1;
  192.     }
  193.     return 1;
  194. }
  195.  
  196. public OnPlayerDeath(playerid, killerid, reason)
  197. {
  198.     if(BusID[playerid])
  199.     {
  200.     BusID[playerid] = 0;
  201.     BusCost[playerid] = 0;
  202.         PlayerSitting[playerid] = 0;
  203.     KillTimer(costtimer);
  204.     SetPlayerVirtualWorld(playerid, 0);
  205.     }
  206.     return 1;
  207. }
  208.  
  209. public OnPlayerText(playerid, text[])
  210. {
  211.     new string[128];
  212.     if(Playerx[playerid] != 0)
  213.     {
  214.     return 0;
  215.     }
  216.     if(BusID[playerid] > 0)
  217.     {
  218.         for(new i=0; i<MAX_PLAYERS; i++)
  219.     {
  220.         if(Playerx[i] != 0)
  221.         {
  222.                 if(BusID[playerid] == BusID[i])
  223.         {
  224.             GetPlayerName(playerid, string, sizeof(string));
  225.                 format(string, sizeof(string), "%s says: %s", string, text);
  226.                     if(IsPlayerInRangeOfPoint(playerid, 10/16, Playerx[i], Playery[i], Playerz[i]))
  227.                     {
  228.                         SendClientMessage(i, 0xE6E6E6E6, string);
  229.                     }
  230.                     else if(IsPlayerInRangeOfPoint(playerid, 10/8, Playerx[i], Playery[i], Playerz[i]))
  231.                 {
  232.                         SendClientMessage(i, 0xC8C8C8C8, string);
  233.                     }
  234.                     else if(IsPlayerInRangeOfPoint(playerid, 10/4, Playerx[i], Playery[i], Playerz[i]))
  235.                 {
  236.                         SendClientMessage(i, 0xAAAAAAAA, string);
  237.                     }
  238.                     else if(IsPlayerInRangeOfPoint(playerid, 10/2, Playerx[i], Playery[i], Playerz[i]))
  239.             {
  240.                         SendClientMessage(i, 0x8C8C8C8C, string);
  241.                     }
  242.                     else if(IsPlayerInRangeOfPoint(playerid, 10, Playerx[i], Playery[i], Playerz[i]))
  243.             {
  244.                         SendClientMessage(i, 0x6E6E6E6E, string);
  245.                     }
  246.                 return 1;
  247.                 }
  248.             }
  249.         }
  250.         GetPlayerName(playerid, string, sizeof(string));
  251.     format(string, sizeof(string), "%s says %s", string, text);
  252.     ProxDetector(10, playerid, string, 0xE6E6E6E6, 0xC8C8C8C8, 0xAAAAAAAA, 0x8C8C8C8C, 0x6E6E6E6E);
  253.     return 0;
  254.     }
  255.     return 1;
  256. }
  257.  
  258. public OnPlayerCommandText(playerid, cmdtext[])
  259. {
  260.     if(strcmp("/gotobluebus", cmdtext, true) == 0)
  261.     {
  262.     if(!IsPlayerAdmin(playerid))
  263.     {
  264.         SendClientMessage(playerid, COLOR_RED, "You are not authorised to use this command.");
  265.         return 1;
  266.         }
  267.     if(BusID[playerid] > 0)
  268.     {
  269.         SetPlayerVirtualWorld(playerid, 0);
  270.     }
  271.     PutPlayerInVehicle(playerid, NPCBlueBus, 2);
  272.     SendClientMessage(playerid, COLOR_DARKAQUA, "You were teleported into the bus");
  273.         return 1;
  274.     }
  275.     if(strcmp("/gotoblackbus", cmdtext, true) == 0)
  276.     {
  277.         if(!IsPlayerAdmin(playerid))
  278.     {
  279.         SendClientMessage(playerid, COLOR_RED, "You are not authorised to use this command.");
  280.         return 1;
  281.     }
  282.     if(BusID[playerid] > 0)
  283.     {
  284.         SetPlayerVirtualWorld(playerid, 0);
  285.     }
  286.     PutPlayerInVehicle(playerid, NPCBlackBus, 2);
  287.     SendClientMessage(playerid, COLOR_DARKAQUA, "You were teleported into the bus");
  288.         return 1;
  289.     }
  290.     if(strcmp("/lookout", cmdtext, true) == 0)
  291.     {
  292.     if(!IsPlayerInRangeOfPoint(playerid, 10, 2021.9390,2241.9487,2103.9536))
  293.     {
  294.         SendClientMessage(playerid, COLOR_RED, "You are not inside a bus");
  295.         return 1;
  296.     }
  297.         GetPlayerPos(playerid, Playerx[playerid], Playery[playerid], Playerz[playerid]);
  298.     GetPlayerFacingAngle(playerid, Playera[playerid]);
  299.     PlayerSkin[playerid] = GetPlayerSkin(playerid);
  300.         SetPlayerInterior(playerid, 0);
  301.         SetPlayerVirtualWorld(playerid, 0);
  302.         TogglePlayerSpectating(playerid, 1);
  303.     if(BusID[playerid] == 1)
  304.     {
  305.             PlayerSpectateVehicle(playerid, NPCBlueBus);
  306.         }
  307.         else
  308.         {
  309.             PlayerSpectateVehicle(playerid, NPCBlackBus);
  310.         }
  311.         SetTimerEx("ResetView", 2000, 0, "d", playerid);
  312.     return 1;
  313.     }
  314.     if(strcmp("/sit", cmdtext, true) == 0)
  315.     {
  316.         ApplyAnimation(playerid,"PED","SEAT_idle",1.0,1,0,0,0,0);
  317.         PlayerSitting[playerid] = 1;
  318.     return 1;
  319.     }
  320.     if(strcmp("/busroute", cmdtext, true) == 0)
  321.     {
  322.     if(IsAtBlueBusStop(playerid))
  323.     {
  324.         SendClientMessage(playerid, COLOR_TEAL, "Blue Bus Route: East Beach - The Stadium - The Gym - The County General Hospital - Los Santos International Airport - Taxi Stand");
  325.         return 1;
  326.     }
  327.     else if(IsAtBlackBusStop(playerid))
  328.     {
  329.         SendClientMessage(playerid, COLOR_TEAL, "Black Bus Route: Taxi Stand - Police Department - The Bank - All Saints Hospital - Market Station - Santa Maria Beach");
  330.         return 1;
  331.     }
  332.     else
  333.     {
  334.         SendClientMessage(playerid, COLOR_RED, "You are not at any bus stop");
  335.     }
  336.     return 1;
  337.     }
  338.     if(strcmp("/buslocation", cmdtext, true) == 0)
  339.     {
  340.         new Float:busx, Float:busy, Float:busz;
  341.     if(IsAtBlueBusStop(playerid))
  342.     {
  343.         GetVehiclePos(NPCBlueBus, busx, busy, busz);
  344.         SetPlayerCheckpoint(playerid, busx, busy, busz, 0);
  345.         GameTextForPlayer(playerid, "~w~Locating ~r~Bus~w~. . . .", 2000, 3);
  346.         SetTimerEx("CPOff", 3000, 0, "d", playerid);
  347.         return 1;
  348.     }
  349.     else if(IsAtBlackBusStop(playerid))
  350.     {
  351.         GetVehiclePos(NPCBlackBus, busx, busy, busz);
  352.             SetPlayerCheckpoint(playerid, busx, busy, busz, 0);
  353.         GameTextForPlayer(playerid, "~w~Locating ~r~Bus~w~. . . .", 2000, 3);
  354.         SetTimerEx("CPOff", 3000, 0, "d", playerid);
  355.         return 1;
  356.     }
  357.     else
  358.     {
  359.         SendClientMessage(playerid, COLOR_RED, "You are not at any bus stop");
  360.     }
  361.     return 1;
  362.     }
  363.     return 0;
  364. }
  365.  
  366. public OnPlayerStateChange(playerid, newstate, oldstate)
  367. {
  368.     if(newstate == PLAYER_STATE_PASSENGER)
  369.     {
  370.     if(GetPlayerVehicleID(playerid) == NPCBlueBus)
  371.     {
  372.             SetPlayerVirtualWorld(playerid, 2);
  373.             SetPlayerPos(playerid, 2021.9740,2235.6626,2103.9536);
  374.             SetPlayerFacingAngle(playerid, 355.3504);
  375.             SetCameraBehindPlayer(playerid);
  376.         SetPlayerInterior(playerid, 1);
  377.         BusID[playerid] = 1;
  378.             GameTextForPlayer(playerid, "~w~Blue Bus", 3000, 1);
  379.         costtimer = SetTimerEx("CostTimer", 30000, 1, "d", playerid);
  380.             BusCost[playerid] += 20;
  381.     }
  382.     else if(GetPlayerVehicleID(playerid) == NPCBlackBus)
  383.     {
  384.             SetPlayerVirtualWorld(playerid, 3);
  385.             SetPlayerPos(playerid, 2021.9740,2235.6626,2103.9536);
  386.             SetPlayerFacingAngle(playerid, 355.3504);
  387.             SetCameraBehindPlayer(playerid);
  388.             SetPlayerInterior(playerid, 1);
  389.         BusID[playerid] = 2;
  390.         GameTextForPlayer(playerid, "~w~Black Bus", 3000, 1);
  391.             costtimer = SetTimerEx("CostTimer", 30000, 1, "d", playerid);
  392.         BusCost[playerid] += 20;
  393.     }
  394.     }
  395.     return 1;
  396. }
  397.  
  398. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  399. {
  400.     new string[128];
  401.     if(newkeys == KEY_SECONDARY_ATTACK)
  402.     {
  403.         if(IsPlayerConnected(playerid))
  404.     {
  405.             if(IsPlayerInRangeOfPoint(playerid, 1, 2021.9740,2235.6626,2103.9536))
  406.         {
  407.                 new Float:busx, Float:busy, Float:busz, Float:angle;
  408.         if(BusID[playerid] == 1)
  409.         {
  410.                     GetVehiclePos(NPCBlueBus, busx, busy, busz);
  411.             GetVehicleZAngle(NPCBlueBus, angle);
  412.         }
  413.         else
  414.         {
  415.                     GetVehiclePos(NPCBlackBus, busx, busy, busz);
  416.             GetVehicleZAngle(NPCBlackBus, angle);
  417.         }
  418.         GetPlayerName(playerid, string, sizeof(string));
  419.                 format(string, sizeof(string), "%s opens the door and exits the bus.", string);
  420.             for(new i=0; i<MAX_PLAYERS; i++)
  421.         {
  422.             if(BusID[i] == BusID[playerid])
  423.             {
  424.             SendClientMessage(i, COLOR_PURPLE, string);
  425.             }
  426.         }
  427.         angle = 360 - angle;
  428.         busx = floatsin(angle,degrees) * 1.5 + floatcos(angle,degrees) * 1.5 + busx;
  429.                 busy = floatcos(angle,degrees) * 1 - floatsin(angle,degrees) * 1 + busy;
  430.                 busz = 1 + busz;
  431.                 SetPlayerVirtualWorld(playerid, 0);
  432.         SetPlayerInterior(playerid, 0);
  433.                 SetPlayerPos(playerid, busx, busy, busz);
  434.         BusID[playerid] = 0;
  435.             KillTimer(costtimer);
  436.             format(string, sizeof(string), "~r~-$%d", BusCost[playerid]);
  437.         GameTextForPlayer(playerid, string, 3000, 1);
  438.         GivePlayerMoney(playerid, -BusCost[playerid]);
  439.         BusCost[playerid] = 0;
  440.             }
  441.     }
  442.     }
  443.     if(newkeys == KEY_CROUCH)
  444.     {
  445.         if(IsPlayerNPC(playerid))
  446.     {
  447.         new npcvehicle = GetPlayerVehicleID(playerid);
  448.         if(npcvehicle == NPCBlueBus)
  449.         {
  450.         if(IsPlayerInRangeOfPoint(playerid, 100, 2868.9033,-1416.4062,11.0131))
  451.             {
  452.                 format(string, sizeof(string), "[Bus Driver] The Bus has reached East Beach.");
  453.             }
  454.                 else if(IsPlayerInRangeOfPoint(playerid, 100, 2636.3242,-1693.125,10.9544))
  455.             {
  456.                 format(string, sizeof(string), "[Bus Driver] The Bus has reached The Stadium.");
  457.             }
  458.                 else if(IsPlayerInRangeOfPoint(playerid, 100, 2243.8457,-1725.9121,13.5960))
  459.                 {
  460.             format(string, sizeof(string), "[Bus Driver] The Bus has reached The Gym.");
  461.         }
  462.                 else if(IsPlayerInRangeOfPoint(playerid, 100, 1948.3310,-1454.3525,13.5960))
  463.         {
  464.                     format(string, sizeof(string), "[Bus Driver] The Bus has reached The County General Hospital.");
  465.             }
  466.             else if(IsPlayerInRangeOfPoint(playerid, 100, 1571.0644,-2188.0107,13.6260))
  467.         {
  468.                     format(string, sizeof(string), "[Bus Driver] The Bus has reached Los Santos International Airport.");
  469.             }
  470.             else if(IsPlayerInRangeOfPoint(playerid, 100, 1712.9423,-1818.7148,13.6260))
  471.         {
  472.                     format(string, sizeof(string), "[Bus Driver] The Bus has reached The Taxi Stand.");
  473.             }
  474.             for(new i = 0; i < MAX_PLAYERS; i++)
  475.                 {
  476.             if(IsPlayerInRangeOfPoint(i, 10, 2021.9390,2241.9487,2103.9536) && BusID[i] == 1)
  477.             {
  478.                         SendClientMessage(i, COLOR_OFFWHITE, string);
  479.             PlayerPlaySound(i, 1147, 0.0, 0.0, 0.0);
  480.             }
  481.             }
  482.         }
  483.             else if(npcvehicle == NPCBlackBus)
  484.         {
  485.                 if(IsPlayerInRangeOfPoint(playerid, 100, 1567.0966,-1725.4755,13.6260))
  486.             {
  487.                 format(string, sizeof(string), "[Bus Driver] The Bus has reached The Police Department.");
  488.             }
  489.                 else if(IsPlayerInRangeOfPoint(playerid, 100, 1503.9716,-1027.7617,23.7701))
  490.             {
  491.                 format(string, sizeof(string), "[Bus Driver] The Bus has reached The Bank.");
  492.             }
  493.                 else if(IsPlayerInRangeOfPoint(playerid, 100, 1188.8359,-1354.6279,13.6483))
  494.                 {
  495.             format(string, sizeof(string), "[Bus Driver] The Bus has reached All Saints Hospital.");
  496.         }
  497.                 else if(IsPlayerInRangeOfPoint(playerid, 100, 861.7125,-1313.3009,13.6260))
  498.         {
  499.                     format(string, sizeof(string), "[Bus Driver] The Bus has reached Market Station.");
  500.             }
  501.                 else if(IsPlayerInRangeOfPoint(playerid, 100, 393.6944,-1766.2702,5.6197))
  502.         {
  503.                     format(string, sizeof(string), "[Bus Driver] The Bus has reached Santa Maria Beach.");
  504.             }
  505.             else if(IsPlayerInRangeOfPoint(playerid, 100, 1705.5898,-1805.8476,13.5300))
  506.         {
  507.                     format(string, sizeof(string), "[Bus Driver] The Bus has reached The Taxi Stand.");
  508.             }
  509.             for(new i = 0; i < MAX_PLAYERS; i++)
  510.                 {
  511.             if(IsPlayerInRangeOfPoint(i, 10, 2021.9390,2241.9487,2103.9536) && BusID[i] == 2)
  512.             {
  513.                         SendClientMessage(i, COLOR_OFFWHITE, string);
  514.             PlayerPlaySound(i, 1147, 0.0, 0.0, 0.0);
  515.             }
  516.             }
  517.         }
  518.         }
  519.     }
  520.     if(newkeys == KEY_FIRE)
  521.     {
  522.         if(PlayerSitting[playerid] == 1)
  523.     {
  524.            ClearAnimations(playerid, 1);
  525.            PlayerSitting[playerid] = 0;
  526.         }
  527.     }
  528.     return 1;
  529. }
  530.  
  531. public IsAtBlueBusStop(playerid)
  532. {
  533.     if(IsPlayerConnected(playerid))
  534.     {
  535.         if(IsPlayerInRangeOfPoint(playerid,2.0,2868.9033,-1416.4062,11.0131) || IsPlayerInRangeOfPoint(playerid,2.0,2636.3242,-1693.125,10.9544) || IsPlayerInRangeOfPoint(playerid,2.0,2649.0073,-1710.6044,11.1854)
  536.            || IsPlayerInRangeOfPoint(playerid,2.0,2243.8457,-1725.9121,13.5960) || IsPlayerInRangeOfPoint(playerid,2.0,2252.8876,-1738.8710,13.6260) || IsPlayerInRangeOfPoint(playerid,2.0,1948.3310,-1454.3525,13.5960)
  537.            || IsPlayerInRangeOfPoint(playerid,2.0,1926.4199,-1472.3593,13.6260) || IsPlayerInRangeOfPoint(playerid,2.0,1571.0644,-2188.0107,13.6260) || IsPlayerInRangeOfPoint(playerid,2.0,1712.9423,-1818.7148,13.6260))
  538.         {
  539.             return 1;
  540.         }
  541.     }
  542.     return 0;
  543. }
  544.  
  545. public IsAtBlackBusStop(playerid)
  546. {
  547.     if(IsPlayerConnected(playerid))
  548.     {
  549.         if(IsPlayerInRangeOfPoint(playerid,2.0,1567.0966,-1725.4755,13.6260) || IsPlayerInRangeOfPoint(playerid,2.0,1544.9990,-1739.0458,13.6260) || IsPlayerInRangeOfPoint(playerid,2.0,1503.9716,-1027.7617,23.7701)
  550.            || IsPlayerInRangeOfPoint(playerid,2.0,1440.3242,-1040.7060,23.9073) || IsPlayerInRangeOfPoint(playerid,2.0,1188.8359,-1354.6279,13.6483) || IsPlayerInRangeOfPoint(playerid,2.0,1212.8427,-1327.8398,13.6470)
  551.            || IsPlayerInRangeOfPoint(playerid,2.0,861.7125,-1313.3009,13.6260) || IsPlayerInRangeOfPoint(playerid,2.0,850.6757,-1333.9707,13.6153) || IsPlayerInRangeOfPoint(playerid,2.0,393.6944,-1766.2702,5.6197)
  552.            || IsPlayerInRangeOfPoint(playerid,2.0,1705.5898,-1805.8476,13.5300))
  553.     {
  554.         return 1;
  555.     }
  556.     }
  557.     return 0;
  558. }
  559.  
  560. public ResetView(playerid)
  561. {
  562.     TogglePlayerSpectating(playerid, 0);
  563.     SetPlayerInterior(playerid, 1);
  564.     SetPlayerPos(playerid, Playerx[playerid], Playery[playerid], Playerz[playerid]);
  565.     SetPlayerFacingAngle(playerid, Playera[playerid]);
  566.     SetPlayerSkin(playerid, PlayerSkin[playerid]);
  567.     SetCameraBehindPlayer(playerid);
  568.     if(PlayerSitting[playerid] == 1)
  569.     {
  570.         ApplyAnimation(playerid,"PED","SEAT_idle",30.0,1,0,0,0,0);
  571.     }
  572.     if(BusID[playerid] == 1)
  573.     {
  574.         SetPlayerVirtualWorld(playerid, 2);
  575.     }
  576.     else
  577.     {
  578.         SetPlayerVirtualWorld(playerid, 3);
  579.     }
  580.     Playerx[playerid] = 0;
  581. }
  582.  
  583. public CPOff(playerid)
  584. {
  585.     DisablePlayerCheckpoint(playerid);
  586. }
  587.  
  588. public CostTimer(playerid)
  589. {
  590.     BusCost[playerid] += 20;
  591. }
  592.  
  593. public ProxDetector(Float:radi, playerid, string[], color1, color2, color3, color4, color5)
  594. {
  595.     if(IsPlayerConnected(playerid))
  596.     {
  597.         new Float:playerposx, Float:playerposy, Float:playerposz;
  598.     GetPlayerPos(playerid, playerposx, playerposy, playerposz);
  599.     for(new i = 0; i < MAX_PLAYERS; i++)
  600.     {
  601.             if(IsPlayerConnected(i))
  602.             {
  603.                 if(GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
  604.         {
  605.             if(IsPlayerInRangeOfPoint(i, radi/16, playerposx, playerposy, playerposz))
  606.             {
  607.                         SendClientMessage(i, color1, string);
  608.                     }
  609.                     else if(IsPlayerInRangeOfPoint(i, radi/8, playerposx, playerposy, playerposz))
  610.             {
  611.                         SendClientMessage(i, color2, string);
  612.                     }
  613.                     else if(IsPlayerInRangeOfPoint(i, radi/4, playerposx, playerposy, playerposz))
  614.             {
  615.                         SendClientMessage(i, color3, string);
  616.                     }
  617.                     else if(IsPlayerInRangeOfPoint(i, radi/2, playerposx, playerposy, playerposz))
  618.                 {
  619.                         SendClientMessage(i, color4, string);
  620.                     }
  621.                     else if(IsPlayerInRangeOfPoint(i, radi, playerposx, playerposy, playerposz))
  622.                 {
  623.                         SendClientMessage(i, color5, string);
  624.                     }
  625.                 }
  626.             }
  627.             else
  628.         {
  629.             SendClientMessage(i, color1, string);
  630.         }
  631.         }
  632.     }
  633.     return 1;
  634. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement