error 010: invalid function or declaration
#1

Well, I got a error.

These is my script:

pawn Код:
if(Vehicles[PlayerVehicle][Faction] != 0 && Vehicles[PlayerVehicle][Faction] != PlayerInfo[playerid][pMember])
    {
            if(Vehicles[PlayerVehicle][Faction] == 1) { ftext = "LSPD"; }
            else if(Vehicles[PlayerVehicle][Faction] == 2) { ftext = "FBI"; }
            else if(Vehicles[PlayerVehicle][Faction] == 3) { ftext = "RCSD"; }
            else if(Vehicles[PlayerVehicle][Faction] == 4) { ftext = "LSFMD"; }
            else if(Vehicles[PlayerVehicle][Faction] == 5) { ftext = "National Guards"; }
            else if(Vehicles[PlayerVehicle][Faction] == 6) { ftext = "Senate"; }
            else if(Vehicles[PlayerVehicle][Faction] == 7) { ftext = "Secret Service"; }
            else if(Vehicles[PlayerVehicle][Faction] == 8) { ftext = "Hitman Agency"; }
            else if(Vehicles[PlayerVehicle][Faction] == 9) { ftext = "News Agency"; }
            else if(Vehicles[PlayerVehicle][Faction] == 10) { ftext = "Taxi Cab Company"; }
            new string[128];
            format( string, sizeof( string ), "This vehicle is only usable by {FF6347}%s{AFAFAF}!", ftext);
            SendClientMessage( playerid, COLOR_GREY, string);
            }
    RemovePlayerFromVehicle(playerid);
        }
        return true;
}
Help me please.
Reply
#2

Which line is the error on? And how have you declared 'ftext'?
Reply
#3

pawn Код:
return true;
there is where my error is.

And yes, I've declared 'ftext'.
Reply
#4

Show us the entire function or a larger snippet of code surrounding the code you've already shown us.
Reply
#5

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Model = GetVehicleModel(vehicleid);
    if(Model == 427 && !ispassenger)
    {
        GetPlayerArmour(playerid, StoreArmour[playerid]);
    }
    if(PlayerTied[playerid] != 0)
    {
        ClearAnimations(playerid);
    }
    if(PlayerCuffed[playerid] != 0)
    {
        ClearAnimations(playerid);
    }
    if(PlayerTackled[playerid] != 0)
    {
        ClearAnimations(playerid);
    }

    new PlayerVehicle = GetVehicleFileID(vehicleid);
    new ftext[20];
    if(Vehicles[PlayerVehicle][Faction] != 0 && Vehicles[PlayerVehicle][Faction] != PlayerInfo[playerid][pMember])
    {
            if(Vehicles[PlayerVehicle][Faction] == 1) { ftext = "LSPD"; }
            else if(Vehicles[PlayerVehicle][Faction] == 2) { ftext = "FBI"; }
            else if(Vehicles[PlayerVehicle][Faction] == 3) { ftext = "RCSD"; }
            else if(Vehicles[PlayerVehicle][Faction] == 4) { ftext = "LSFMD"; }
            else if(Vehicles[PlayerVehicle][Faction] == 5) { ftext = "National Guards"; }
            else if(Vehicles[PlayerVehicle][Faction] == 6) { ftext = "Senate"; }
            else if(Vehicles[PlayerVehicle][Faction] == 7) { ftext = "Secret Service"; }
            else if(Vehicles[PlayerVehicle][Faction] == 8) { ftext = "Hitman Agency"; }
            else if(Vehicles[PlayerVehicle][Faction] == 9) { ftext = "News Agency"; }
            else if(Vehicles[PlayerVehicle][Faction] == 10) { ftext = "Taxi Cab Company"; }
            new string[128];
            format( string, sizeof( string ), "This vehicle is only usable by {FF6347}%s{AFAFAF}!", ftext);
            SendClientMessage( playerid, COLOR_GREY, string);
            }
    RemovePlayerFromVehicle(playerid);
        }
        return true;
}
Reply
#6

It looks like you've got one more bracket than you should have.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new Model = GetVehicleModel(vehicleid);
    if(Model == 427 && !ispassenger)
    {
        GetPlayerArmour(playerid, StoreArmour[playerid]);
    }
    if(PlayerTied[playerid] != 0)
    {
        ClearAnimations(playerid);
    }
    if(PlayerCuffed[playerid] != 0)
    {
        ClearAnimations(playerid);
    }
    if(PlayerTackled[playerid] != 0)
    {
        ClearAnimations(playerid);
    }

    new PlayerVehicle = GetVehicleFileID(vehicleid);
    new ftext[20];
    if(Vehicles[PlayerVehicle][Faction] != 0 && Vehicles[PlayerVehicle][Faction] != PlayerInfo[playerid][pMember])
    {
        if(Vehicles[PlayerVehicle][Faction] == 1) { ftext = "LSPD"; }
        else if(Vehicles[PlayerVehicle][Faction] == 2) { ftext = "FBI"; }
        else if(Vehicles[PlayerVehicle][Faction] == 3) { ftext = "RCSD"; }
        else if(Vehicles[PlayerVehicle][Faction] == 4) { ftext = "LSFMD"; }
        else if(Vehicles[PlayerVehicle][Faction] == 5) { ftext = "National Guards"; }
        else if(Vehicles[PlayerVehicle][Faction] == 6) { ftext = "Senate"; }
        else if(Vehicles[PlayerVehicle][Faction] == 7) { ftext = "Secret Service"; }
        else if(Vehicles[PlayerVehicle][Faction] == 8) { ftext = "Hitman Agency"; }
        else if(Vehicles[PlayerVehicle][Faction] == 9) { ftext = "News Agency"; }
        else if(Vehicles[PlayerVehicle][Faction] == 10) { ftext = "Taxi Cab Company"; }

        new string[128];
        format( string, sizeof( string ), "This vehicle is only usable by {FF6347}%s{AFAFAF}!", ftext);
        SendClientMessage( playerid, COLOR_GREY, string);
        RemovePlayerFromVehicle(playerid);
    }
   
    return true;
}
I also went through the trouble of sorting the indentation out - so it's a little neater, the extra bracket was after where SendClientMessage was placed.
Reply
#7

Okey thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)