Guest User

Joe Torran C

a guest
Apr 18th, 2010
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.78 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define FILTERSCRIPT
  5. #if defined FILTERSCRIPT
  6.  
  7. #define F_VERSION "v1"
  8.  
  9. #define COLOR_RED 0xFF0000FF
  10. #define COLOR_GREY 0x7F7F7F7F
  11. #define COLOR_WHITE 0xFFFFFFFF
  12. #define COLOR_YELLOW 0xFFFF00FF
  13.  
  14. #define NEEDSTOBEPILOT
  15.  
  16. #define ID_FLIGHT1 2598
  17. #define ID_FLIGHT2 2599
  18.  
  19. new PlayerPilot[MAX_PLAYERS];
  20. new FlightDepart[MAX_PLAYERS];
  21. new FlightArrive[MAX_PLAYERS];
  22.  
  23. public OnFilterScriptInit() {
  24.     printf("\n | * Torran's Basic Flight System %s * |", F_VERSION);
  25.     printf(" | * Loaded onto server              * | \n");
  26.     return 1;
  27. }
  28.  
  29. public OnFilterScriptExit() {
  30.     printf("\n | * Torran's Basic Flight System %s * |", F_VERSION);
  31.     printf(" | * Unloaded from server            * | \n");
  32.     return 1;
  33. }
  34.  
  35. #endif
  36.  
  37. public OnPlayerConnect(playerid) {
  38.     SendClientMessage(playerid, COLOR_YELLOW, "This server is running Torran's Basic Flight System");
  39.     FlightDepart[playerid] = 0;
  40.     FlightArrive[playerid] = 0;
  41.     PlayerPilot[playerid] = 0;
  42.     return 1;
  43. }
  44.  
  45. public OnPlayerText(playerid, text[]) {
  46.     if(text[0] == '=') {
  47.         new string[128];
  48.         format(string, sizeof string, "Pilot Radio: (%s): %s", PlayersName(playerid), text[1]);
  49.         SendClientMessageToAll(COLOR_GREY, string);
  50.         return 0;
  51.     }
  52.     return 1;
  53. }
  54.  
  55. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  56.     if(dialogid == ID_FLIGHT1) {
  57.         if(response) {
  58.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, ID_FLIGHT1, DIALOG_STYLE_INPUT, "Departing from", "Please fill in the field \n\nPlease input the airport you're departing from", "Continue", "Cancel");
  59.             ShowPlayerDialog(playerid, ID_FLIGHT2, DIALOG_STYLE_INPUT, "Arriving at", "Please input the airport you're arriving at", "Done", "Cancel");
  60.             format(FlightDepart[playerid], sizeof(FlightDepart), "%s", inputtext);
  61.         }
  62.     }
  63.     if(dialogid == ID_FLIGHT2) {
  64.         if(response) {
  65.             new string[128];
  66.             if(!strlen(inputtext)) return ShowPlayerDialog(playerid, ID_FLIGHT2, DIALOG_STYLE_INPUT, "Arriving at", "~r~Please fill in the field ~w~\n\nPlease input the airport you're arriving at", "Done", "Cancel");
  67.             format(FlightArrive[playerid], sizeof(FlightArrive), "%s", inputtext);
  68.             format(string, sizeof string, "Flight by %s: Departing From: %s: Arriving At: %s:", PlayersName(playerid), FlightDepart[playerid], FlightArrive[playerid]);
  69.             SendClientMessageToAll(COLOR_WHITE, string);
  70.         }
  71.     }
  72.     return 0;
  73. }
  74.  
  75. forward IsAircraft(vehicleid);
  76. public IsAircraft(vehicleid) {
  77.     switch(GetVehicleModel(vehicleid)) {
  78.         case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 548, 425, 417, 487, 488, 497, 563, 447, 469: return 1;
  79.     }
  80.     return 0;
  81. }
  82.  
  83. forward IsPlayerPilot(playerid);
  84. public IsPlayerPilot(playerid)
  85. {
  86.     switch(PlayerPilot[playerid]) {
  87.         case 1: return 1;
  88.     }
  89.     return 0;
  90. }
  91.  
  92. CMD:takeoff(playerid, params[]) {
  93.     new vehicleid = GetPlayerVehicleID(playerid); new string[128];
  94.     #if defined NEEDSTOBEPILOT
  95.     if(!IsPlayerPilot(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not a pilot, Become one by using /makemepilot");
  96.     #endif
  97.     if(!IsAircraft(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a plane to use this command");
  98.     if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /takeoff [ls/lv/sf]");
  99.    
  100.     if(strcmp(params, "ls", true) == 0) {
  101.         format(string, sizeof string, "%s is taking off from LS Airport", PlayersName(playerid));
  102.         SendClientMessageToAll(COLOR_WHITE, string);
  103.         format(string, sizeof string, "~w~%s is taking off from~n~LS Airport", PlayersName(playerid));
  104.         GameTextForAll(string, 1000, 1);
  105.         return 1;
  106.     }
  107.     if(strcmp(params, "lv", true) == 0) {
  108.         format(string, sizeof string, "%s is taking off from LV Airport", PlayersName(playerid));
  109.         SendClientMessageToAll(COLOR_WHITE, string);
  110.         format(string, sizeof string, "~w~%s is taking off from~n~LV Airport", PlayersName(playerid));
  111.         GameTextForAll(string, 1000, 1);
  112.         return 1;
  113.     }
  114.     if(strcmp(params, "sf", true) == 0) {
  115.         format(string, sizeof string, "%s is taking off from SF Airport", PlayersName(playerid));
  116.         SendClientMessageToAll(COLOR_WHITE, string);
  117.         format(string, sizeof string, "~w~%s is taking off from~n~SF Airport", PlayersName(playerid));
  118.         GameTextForAll(string, 1000, 1);
  119.         return 1;
  120.     }
  121.     return SendClientMessage(playerid, COLOR_RED, "Invalid airport");
  122. }
  123.  
  124. CMD:land(playerid, params[]) {
  125.     new vehicleid = GetPlayerVehicleID(playerid); new string[128];
  126.     #if defined NEEDSTOBEPILOT
  127.     if(!IsPlayerPilot(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not a pilot, Become one by using /makemepilot");
  128.     #endif
  129.     if(!IsAircraft(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a plane to use this command");
  130.     if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /land [ls/lv/sf]");
  131.  
  132.     if(strcmp(params, "ls", true) == 0) {
  133.         format(string, sizeof string, "%s is landing at LS Airport", PlayersName(playerid));
  134.         SendClientMessageToAll(COLOR_WHITE, string);
  135.         format(string, sizeof string, "~w~%s is landing at~n~LS Airport", PlayersName(playerid));
  136.         GameTextForAll(string, 1000, 1);
  137.         return 1;
  138.     }
  139.     if(strcmp(params, "lv", true) == 0) {
  140.         format(string, sizeof string, "%s is landing at LV Airport", PlayersName(playerid));
  141.         SendClientMessageToAll(COLOR_WHITE, string);
  142.         format(string, sizeof string, "~w~%s is landing at~n~LV Airport", PlayersName(playerid));
  143.         GameTextForAll(string, 1000, 1);
  144.         return 1;
  145.     }
  146.     if(strcmp(params, "sf", true) == 0) {
  147.         format(string, sizeof string, "%s is landing at SF Airport", PlayersName(playerid));
  148.         SendClientMessageToAll(COLOR_WHITE, string);
  149.         format(string, sizeof string, "~w~%s is landing at~n~SF Airport", PlayersName(playerid));
  150.         GameTextForAll(string, 1000, 1);
  151.         return 1;
  152.     }
  153.     return SendClientMessage(playerid, COLOR_RED, "Invalid airport");
  154. }
  155.  
  156. CMD:flight(playerid, params[]) {
  157.     new vehicleid = GetPlayerVehicleID(playerid);
  158.     #if defined NEEDSTOBEPILOT
  159.     if(!IsPlayerPilot(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not a pilot, Become one by using /makemepilot");
  160.     #endif
  161.     if(!IsAircraft(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a plane to use this command");
  162.    
  163.     ShowPlayerDialog(playerid, ID_FLIGHT1, DIALOG_STYLE_INPUT, "Departing from", "Please input the airport you're departing from", "Continue", "Cancel");
  164.     return 1;
  165. }
  166.  
  167. CMD:makemepilot(playerid, params[]) {
  168.     switch(PlayerPilot[playerid]) {
  169.         case 0: {
  170.             PlayerPilot[playerid] = 1;
  171.             SendClientMessage(playerid, COLOR_WHITE, "You are now a pilot");
  172.         }
  173.         case 1: {
  174.             SendClientMessage(playerid, COLOR_RED, "You are already a pilot");
  175.         }
  176.     }
  177.     return 1;
  178. }
  179.  
  180. stock PlayersName(playerid) {
  181.     new PlayerName[MAX_PLAYER_NAME];
  182.     GetPlayerName(playerid, PlayerName, sizeof PlayerName);
  183.     return PlayerName;
  184. }
Advertisement
Add Comment
Please, Sign In to add comment