Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #define FILTERSCRIPT
- #if defined FILTERSCRIPT
- #define F_VERSION "v1"
- #define COLOR_RED 0xFF0000FF
- #define COLOR_GREY 0x7F7F7F7F
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_YELLOW 0xFFFF00FF
- #define NEEDSTOBEPILOT
- #define ID_FLIGHT1 2598
- #define ID_FLIGHT2 2599
- new PlayerPilot[MAX_PLAYERS];
- new FlightDepart[MAX_PLAYERS];
- new FlightArrive[MAX_PLAYERS];
- public OnFilterScriptInit() {
- printf("\n | * Torran's Basic Flight System %s * |", F_VERSION);
- printf(" | * Loaded onto server * | \n");
- return 1;
- }
- public OnFilterScriptExit() {
- printf("\n | * Torran's Basic Flight System %s * |", F_VERSION);
- printf(" | * Unloaded from server * | \n");
- return 1;
- }
- #endif
- public OnPlayerConnect(playerid) {
- SendClientMessage(playerid, COLOR_YELLOW, "This server is running Torran's Basic Flight System");
- FlightDepart[playerid] = 0;
- FlightArrive[playerid] = 0;
- PlayerPilot[playerid] = 0;
- return 1;
- }
- public OnPlayerText(playerid, text[]) {
- if(text[0] == '=') {
- new string[128];
- format(string, sizeof string, "Pilot Radio: (%s): %s", PlayersName(playerid), text[1]);
- SendClientMessageToAll(COLOR_GREY, string);
- return 0;
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- if(dialogid == ID_FLIGHT1) {
- if(response) {
- 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");
- ShowPlayerDialog(playerid, ID_FLIGHT2, DIALOG_STYLE_INPUT, "Arriving at", "Please input the airport you're arriving at", "Done", "Cancel");
- format(FlightDepart[playerid], sizeof(FlightDepart), "%s", inputtext);
- }
- }
- if(dialogid == ID_FLIGHT2) {
- if(response) {
- new string[128];
- 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");
- format(FlightArrive[playerid], sizeof(FlightArrive), "%s", inputtext);
- format(string, sizeof string, "Flight by %s: Departing From: %s: Arriving At: %s:", PlayersName(playerid), FlightDepart[playerid], FlightArrive[playerid]);
- SendClientMessageToAll(COLOR_WHITE, string);
- }
- }
- return 0;
- }
- forward IsAircraft(vehicleid);
- public IsAircraft(vehicleid) {
- switch(GetVehicleModel(vehicleid)) {
- case 592, 577, 511, 512, 593, 520, 553, 476, 519, 460, 513, 548, 425, 417, 487, 488, 497, 563, 447, 469: return 1;
- }
- return 0;
- }
- forward IsPlayerPilot(playerid);
- public IsPlayerPilot(playerid)
- {
- switch(PlayerPilot[playerid]) {
- case 1: return 1;
- }
- return 0;
- }
- CMD:takeoff(playerid, params[]) {
- new vehicleid = GetPlayerVehicleID(playerid); new string[128];
- #if defined NEEDSTOBEPILOT
- if(!IsPlayerPilot(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not a pilot, Become one by using /makemepilot");
- #endif
- if(!IsAircraft(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a plane to use this command");
- if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /takeoff [ls/lv/sf]");
- if(strcmp(params, "ls", true) == 0) {
- format(string, sizeof string, "%s is taking off from LS Airport", PlayersName(playerid));
- SendClientMessageToAll(COLOR_WHITE, string);
- format(string, sizeof string, "~w~%s is taking off from~n~LS Airport", PlayersName(playerid));
- GameTextForAll(string, 1000, 1);
- return 1;
- }
- if(strcmp(params, "lv", true) == 0) {
- format(string, sizeof string, "%s is taking off from LV Airport", PlayersName(playerid));
- SendClientMessageToAll(COLOR_WHITE, string);
- format(string, sizeof string, "~w~%s is taking off from~n~LV Airport", PlayersName(playerid));
- GameTextForAll(string, 1000, 1);
- return 1;
- }
- if(strcmp(params, "sf", true) == 0) {
- format(string, sizeof string, "%s is taking off from SF Airport", PlayersName(playerid));
- SendClientMessageToAll(COLOR_WHITE, string);
- format(string, sizeof string, "~w~%s is taking off from~n~SF Airport", PlayersName(playerid));
- GameTextForAll(string, 1000, 1);
- return 1;
- }
- return SendClientMessage(playerid, COLOR_RED, "Invalid airport");
- }
- CMD:land(playerid, params[]) {
- new vehicleid = GetPlayerVehicleID(playerid); new string[128];
- #if defined NEEDSTOBEPILOT
- if(!IsPlayerPilot(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not a pilot, Become one by using /makemepilot");
- #endif
- if(!IsAircraft(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a plane to use this command");
- if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /land [ls/lv/sf]");
- if(strcmp(params, "ls", true) == 0) {
- format(string, sizeof string, "%s is landing at LS Airport", PlayersName(playerid));
- SendClientMessageToAll(COLOR_WHITE, string);
- format(string, sizeof string, "~w~%s is landing at~n~LS Airport", PlayersName(playerid));
- GameTextForAll(string, 1000, 1);
- return 1;
- }
- if(strcmp(params, "lv", true) == 0) {
- format(string, sizeof string, "%s is landing at LV Airport", PlayersName(playerid));
- SendClientMessageToAll(COLOR_WHITE, string);
- format(string, sizeof string, "~w~%s is landing at~n~LV Airport", PlayersName(playerid));
- GameTextForAll(string, 1000, 1);
- return 1;
- }
- if(strcmp(params, "sf", true) == 0) {
- format(string, sizeof string, "%s is landing at SF Airport", PlayersName(playerid));
- SendClientMessageToAll(COLOR_WHITE, string);
- format(string, sizeof string, "~w~%s is landing at~n~SF Airport", PlayersName(playerid));
- GameTextForAll(string, 1000, 1);
- return 1;
- }
- return SendClientMessage(playerid, COLOR_RED, "Invalid airport");
- }
- CMD:flight(playerid, params[]) {
- new vehicleid = GetPlayerVehicleID(playerid);
- #if defined NEEDSTOBEPILOT
- if(!IsPlayerPilot(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not a pilot, Become one by using /makemepilot");
- #endif
- if(!IsAircraft(vehicleid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a plane to use this command");
- ShowPlayerDialog(playerid, ID_FLIGHT1, DIALOG_STYLE_INPUT, "Departing from", "Please input the airport you're departing from", "Continue", "Cancel");
- return 1;
- }
- CMD:makemepilot(playerid, params[]) {
- switch(PlayerPilot[playerid]) {
- case 0: {
- PlayerPilot[playerid] = 1;
- SendClientMessage(playerid, COLOR_WHITE, "You are now a pilot");
- }
- case 1: {
- SendClientMessage(playerid, COLOR_RED, "You are already a pilot");
- }
- }
- return 1;
- }
- stock PlayersName(playerid) {
- new PlayerName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, PlayerName, sizeof PlayerName);
- return PlayerName;
- }
Advertisement
Add Comment
Please, Sign In to add comment