Why the code is not working ?
#1

Hello guys i was implementing Torran's Flight System into my server in of my faction LSAIR. I got the script compiling without any errors but when i type /flight /takeoff /land no dialog or message is poping up also when i do "=something" is not showing the Pilot Radio thingy. I don't know what is the error can you please help me ? this is my code.

pawn Код:
#define ID_FLIGHT1 2598
#define ID_FLIGHT2 2599

new FlightDepart[MAX_PLAYERS];
new FlightArrive[MAX_PLAYERS];

public OnPlayerText(playerid, text[]){
if(PlayerInfo[playerid][pLeader] == 15 && PlayerInfo[playerid][pRank] == 2 && PlayerInfo[playerid][pRank] == 3 && PlayerInfo[playerid][pRank] == 4)
    {
    if(text[0] == '=') {
                new string[128];
                format(string, sizeof string, "Pilot Radio: (%s): %s", PlayersName(playerid), text[1]);
                SendClientMessageToAll(COLOR_GREY, string);
                return 0;
        }
    }
}
//LSAIR CMDS
CMD:takeoff(playerid, params[]) {
        if (PlayerInfo[playerid][pMember] == 15 && PlayerInfo[playerid][pRank] == 2 && PlayerInfo[playerid][pRank] == 3 && PlayerInfo[playerid][pRank] == 6){
        new vehicleid = GetPlayerVehicleID(playerid); new string[128];
        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");
}
                return 1;
}

CMD:land(playerid, params[]) {
        if (PlayerInfo[playerid][pMember] == 15 && PlayerInfo[playerid][pRank] == 2 && PlayerInfo[playerid][pRank] == 3 && PlayerInfo[playerid][pRank] == 6){
        new vehicleid = GetPlayerVehicleID(playerid); new string[128];
        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");
}
                return 1;
}

CMD:flight(playerid, params[]) {
        if (PlayerInfo[playerid][pMember] == 15 && PlayerInfo[playerid][pRank] == 2 && PlayerInfo[playerid][pRank] == 3 && PlayerInfo[playerid][pRank] == 6){
        new vehicleid = GetPlayerVehicleID(playerid);
        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;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == ID_FLIGHT1) {
                if(response) {
                        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];
                        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);
                }
        }

}
Reply
#2

Change:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == ID_FLIGHT1) {
                if(response) {
                        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];
                        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);
                }
        }

}
To:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == ID_FLIGHT1) {
                if(response) {
                        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);
                }
        }
        return 1;
       
        if(dialogid == ID_FLIGHT2) {
                if(response) {
                    new string[128];
                        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 1;

}
Reply
#3

Quote:
Originally Posted by Dubya
Посмотреть сообщение
Change:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == ID_FLIGHT1) {
                if(response) {
                        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];
                        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);
                }
        }

}
To:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == ID_FLIGHT1) {
                if(response) {
                        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);
                }
        }
        return 1;
       
        if(dialogid == ID_FLIGHT2) {
                if(response) {
                    new string[128];
                        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 1;

}
Код:
D:\Documents and Settings\Silvia\Desktop\BFRP.pwn(74484) : warning 225: unreachable code
D:\Documents and Settings\Silvia\Desktop\BFRP.pwn(74495) : warning 225: unreachable code
I know it's warning but is that a problem ? And also do u know how to fix the Pilot Radio ?
Reply
#4

its suppose to be like this i think... but i dont think this will fix ur problem...
Reply
#5

Quote:
Originally Posted by Crazymax
Посмотреть сообщение
its suppose to be like this i think... but i dont think this will fix ur problem...
anyone got a solution for this ?
Reply
#6

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == ID_FLIGHT1) {
                if(response) {
                        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);
                        return 1;
                }
        }
       
        if(dialogid == ID_FLIGHT2) {
                if(response) {
                    new string[128];
                        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 1;
                }
        }

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)