Guest User

Untitled

a guest
Sep 8th, 2008
1,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.07 KB | None | 0 0
  1. #include <a_samp>
  2. #include <cpstream>
  3.  
  4. // This is a comment
  5. // uncomment the line below if you want to write a filterscript
  6. #define FILTERSCRIPT
  7.  
  8. #if defined FILTERSCRIPT
  9.  
  10. #define COLOR_GREY 0xAFAFAFAA
  11. #define COLOR_GREEN 0x33AA33AA
  12. #define COLOR_RED 0xAA3333AA
  13. #define COLOR_YELLOW 0xFFFF00AA
  14. #define COLOR_WHITE 0xFFFFFFAA
  15. #define COLOR_BLUE 0x0000BBAA
  16. #define COLOR_LIGHTBLUE 0x33CCFFAA
  17. #define COLOR_ORANGE 0xFF9900AA
  18. #define COLOR_PURPLE 0x9900FFAA
  19. #define COLOR_BRIGHTRED 0xFF0000AA
  20.  
  21. forward FlightStart();
  22. forward FlightEnd();
  23.  
  24. new Menu:Tickets;
  25. new Destination[MAX_PLAYERS];
  26. new LVAP;
  27. new LVAPout;
  28. new BuyT;
  29. new SFAP;
  30. new LSAP;
  31.  
  32. public OnFilterScriptInit()
  33. {
  34.     print("\n--------------------------------------");
  35.     print(" Plane Ticket FS - By Yaheli");
  36.     print("--------------------------------------\n");
  37.    
  38.     /*================*
  39.     * Plane Tickets Sys
  40.     *=================*/
  41.     BuyT = CPS_AddCheckpoint(-1829.6534, 17.6364, 1061.1436, 1.5, 35);
  42.  
  43.     LVAP = CreatePickup(1318, 2, 1673.6857, 1447.8342, 10.7847);
  44.     LVAPout = CreatePickup(1318, 2, -1830.5490, 5.7798, 1061.1436);
  45.     SFAP = CreatePickup(1318, 2, -1421.7201, -288.6679, 14.1484);
  46.     LSAP = CreatePickup(1318, 2, 1685.4467, -2334.0562, 13.5469);
  47.  
  48.     Tickets = CreateMenu("Plane Tickets", 1, 50.0, 180.0, 200.0, 200.0);
  49.     SetMenuColumnHeader(Tickets, 0, "Select a Destination"); // Plane Selection Menu
  50.     AddMenuItem(Tickets, 0, "Las Venturas  -  $1000");
  51.     AddMenuItem(Tickets, 0, "San Fierro  -  $1000");
  52.     AddMenuItem(Tickets, 0, "Los Santos  -  $1000");
  53.     AddMenuItem(Tickets, 0, "- Exit Menu -");
  54.  
  55.     SetTimer("FlightStart", 300000, 1);
  56.     //==========================================================================
  57.     return 1;
  58. }
  59.  
  60. public OnFilterScriptExit()
  61. {
  62.     return 1;
  63. }
  64.  
  65. #else
  66.  
  67. #endif
  68.  
  69. public OnPlayerSpawn(playerid)
  70. {
  71.     return 1;
  72. }
  73.  
  74. public OnPlayerDeath(playerid, killerid, reason)
  75. {
  76.     return 1;
  77. }
  78.  
  79. public OnVehicleSpawn(vehicleid)
  80. {
  81.     return 1;
  82. }
  83.  
  84. public OnVehicleDeath(vehicleid, killerid)
  85. {
  86.     return 1;
  87. }
  88.  
  89. public OnPlayerText(playerid, text[])
  90. {
  91.     return 1;
  92. }
  93.  
  94. public OnPlayerPrivmsg(playerid, recieverid, text[])
  95. {
  96.     return 1;
  97. }
  98.  
  99. public OnPlayerCommandText(playerid, cmdtext[])
  100. {
  101.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  102.     {
  103.         // Do something here
  104.         return 1;
  105.     }
  106.     return 0;
  107. }
  108.  
  109. public OnPlayerInfoChange(playerid)
  110. {
  111.     return 1;
  112. }
  113.  
  114. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  115. {
  116.     return 1;
  117. }
  118.  
  119. public OnPlayerExitVehicle(playerid, vehicleid)
  120. {
  121.     return 1;
  122. }
  123.  
  124. public OnPlayerStateChange(playerid, newstate, oldstate)
  125. {
  126.     return 1;
  127. }
  128.  
  129. public OnPlayerEnterCheckpoint(playerid)
  130. {
  131.     new cp;
  132.     cp = CPS_GetPlayerCheckpoint(playerid);
  133.     if (cp == BuyT)
  134.     {
  135.         SendClientMessage(playerid, COLOR_WHITE, "In order to buy a ticket you must first pick a destination.");
  136.         ShowMenuForPlayer(Tickets, playerid);
  137.         TogglePlayerControllable(playerid, 0);
  138.     }
  139.     return 1;
  140. }
  141.  
  142. public OnPlayerLeaveCheckpoint(playerid)
  143. {
  144.     return 1;
  145. }
  146.  
  147. public OnPlayerEnterRaceCheckpoint(playerid)
  148. {
  149.     return 1;
  150. }
  151.  
  152. public OnPlayerLeaveRaceCheckpoint(playerid)
  153. {
  154.     return 1;
  155. }
  156.  
  157. public OnRconCommand(cmd[])
  158. {
  159.     return 1;
  160. }
  161.  
  162. public OnObjectMoved(objectid)
  163. {
  164.     return 1;
  165. }
  166.  
  167. public OnPlayerObjectMoved(playerid, objectid)
  168. {
  169.     return 1;
  170. }
  171.  
  172. public OnPlayerPickUpPickup(playerid, pickupid)
  173. {
  174.     if(pickupid == LVAP)
  175.     {
  176.         if(IsPlayerInAnyVehicle(playerid)) return 0;
  177.         SetPlayerInterior(playerid, 14);
  178.         SetPlayerPos(playerid, -1827.147338, 7.207418, 1061.143554);
  179.         SetPlayerVirtualWorld(playerid, 111);
  180.     }
  181.     else if(pickupid == SFAP)
  182.     {
  183.         if(IsPlayerInAnyVehicle(playerid)) return 0;
  184.         SetPlayerInterior(playerid, 14);
  185.         SetPlayerPos(playerid, -1827.147338, 7.207418, 1061.143554);
  186.         SetPlayerVirtualWorld(playerid, 222);
  187.     }
  188.     else if(pickupid == LSAP)
  189.     {
  190.         if(IsPlayerInAnyVehicle(playerid)) return 0;
  191.         SetPlayerInterior(playerid, 14);
  192.         SetPlayerPos(playerid, -1827.147338, 7.207418, 1061.143554);
  193.         SetPlayerVirtualWorld(playerid, 333);
  194.     }
  195.     else if(pickupid == LVAPout)
  196.     {
  197.         if(GetPlayerVirtualWorld(playerid) == 111)
  198.         {
  199.             SetPlayerInterior(playerid, 0);
  200.             SetPlayerVirtualWorld(playerid, 0);
  201.             SetPlayerPos(playerid, 1673.6857, 1447.8342, 10.7847);
  202.         }
  203.         else if(GetPlayerVirtualWorld(playerid) == 222)
  204.         {
  205.             SetPlayerInterior(playerid, 0);
  206.             SetPlayerVirtualWorld(playerid, 0);
  207.             SetPlayerPos(playerid, -1422.7201, -288.6679, 14.1484);
  208.         }
  209.         else if(GetPlayerVirtualWorld(playerid) == 333)
  210.         {
  211.             SetPlayerInterior(playerid, 0);
  212.             SetPlayerVirtualWorld(playerid, 0);
  213.             SetPlayerPos(playerid, 1686.4467, -2334.0562, 13.5469);
  214.         }
  215.     }
  216.     return 1;
  217. }
  218.  
  219. public OnPlayerSelectedMenuRow(playerid, row)
  220. {
  221.     new Menu:current;
  222.     current = GetPlayerMenu(playerid);
  223.     if(current == Tickets)
  224.     {
  225.         TogglePlayerControllable(playerid, 1);
  226.         switch(row)
  227.         {
  228.             case 0: // Los Santos
  229.             {
  230.                 if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You don't have $1,000!");
  231.                 Destination[playerid] = 1;
  232.                 SendClientMessage(playerid, COLOR_WHITE, "You bought a ticket to Las Venturas. You will be teleported to a plane shortly.");
  233.                 HideMenuForPlayer(Tickets, playerid);
  234.                 GivePlayerMoney(playerid, -1000);
  235.             }
  236.             case 1: // San Fierro
  237.             {
  238.                 if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You don't have $1,000!");
  239.                 Destination[playerid] = 2;
  240.                 SendClientMessage(playerid, COLOR_WHITE, "You bought a ticket to San Fierro. You will be teleported to a plane shortly.");
  241.                 HideMenuForPlayer(Tickets, playerid);
  242.                 GivePlayerMoney(playerid, -1000);
  243.             }
  244.             case 2: // Las Venturas
  245.             {
  246.                 if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You don't have $1,000!");
  247.                 Destination[playerid] = 3;
  248.                 SendClientMessage(playerid, COLOR_WHITE, "You bought a ticket to Los Santos. You will be teleported to a plane shortly.");
  249.                 HideMenuForPlayer(Tickets, playerid);
  250.                 GivePlayerMoney(playerid, -1000);
  251.             }
  252.             case 3: // Exit Menu
  253.             {
  254.                 HideMenuForPlayer(Tickets, playerid);
  255.             }
  256.         }
  257.     }
  258.     return 1;
  259. }
  260.  
  261. public OnPlayerExitedMenu(playerid)
  262. {
  263.     return 1;
  264. }
  265.  
  266. public FlightStart()
  267. {
  268.     for(new i = 0; i < MAX_PLAYERS; i++)
  269.     {
  270.         if(IsPlayerConnected(i))
  271.         {
  272.             if(Destination[i] != 0)
  273.             {
  274.                 SendClientMessage(i, COLOR_WHITE, "30 seconds until landing.");
  275.                 GameTextForPlayer(i, "~y~[] ~b~Take Off!~y~[]", 4000, 3); //actually ] is a star
  276.                 SetPlayerPos(i, 2.384830, 33.103397, 1199.849976);          //and [ is nothing
  277.                 SetPlayerInterior(i, 1);
  278.                 PlaySound(i, 1097);
  279.                 SetTimer("FlightEnd", 30000, 0);
  280.             }
  281.         }
  282.     }
  283. }
  284.  
  285. public FlightEnd()
  286. {
  287.     for(new i = 0; i < MAX_PLAYERS; i++)
  288.     {
  289.         switch (Destination[i])
  290.         {
  291.             case 0:
  292.             {
  293.                 // ~~!!~~Leave Space Blank~~!!~~
  294.             }
  295.             case 1:
  296.             {
  297.                 SetPlayerVirtualWorld(i, 111);
  298.                 SetPlayerInterior(i, 14);
  299.                 SetPlayerPos(i, -1827.147338, 7.207418, 1061.143554);
  300.                 GameTextForPlayer(i, "~w~Welcome to ~y~Las venturas", 4000, 3);
  301.                 Destination[i] = 0;
  302.                 PlaySound(i, 1063);
  303.             }
  304.             case 2:
  305.             {
  306.                 SetPlayerVirtualWorld(i, 222);
  307.                 SetPlayerInterior(i, 14);
  308.                 SetPlayerPos(i, -1827.147338, 7.207418, 1061.143554);
  309.                 GameTextForPlayer(i, "~w~Welcome to ~r~San Fierro", 4000, 3);
  310.                 Destination[i] = 0;
  311.                 PlaySound(i, 1063);
  312.             }
  313.             case 3:
  314.             {
  315.                 SetPlayerVirtualWorld(i, 333);
  316.                 SetPlayerInterior(i, 14);
  317.                 SetPlayerPos(i, -1827.147338, 7.207418, 1061.143554);
  318.                 GameTextForPlayer(i, "~w~Welcome to ~g~Los Santos", 4000, 3);
  319.                 Destination[i] = 0;
  320.                 PlaySound(i, 1063);
  321.             }
  322.  
  323.         }
  324.     }
  325. }
  326.  
  327. stock PlaySound ( playerid, sound )
  328. {
  329.     new Float:X,Float:Y,Float:Z;
  330.     GetPlayerPos(playerid, X, Y, Z);
  331.     PlayerPlaySound(playerid, sound, X, Y, Z);
  332.     return sound;
  333. }
Advertisement
Add Comment
Please, Sign In to add comment