SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/11/2011, 02:15 PM   #1
Meinstad
Huge Clucker
 
Meinstad's Avatar
 
Join Date: Sep 2010
Location: Northpole
Posts: 364
Reputation: 31
Default error 010: invalid function or declaration

Well, I got a error.

These is my script:

pawn Code:
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.
__________________
Meinstad is offline   Reply With Quote
Old 10/11/2011, 02:17 PM   #2
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,140
Reputation: 1127
Default Re: error 010: invalid function or declaration

Which line is the error on? And how have you declared 'ftext'?
Calgon is offline   Reply With Quote
Old 10/11/2011, 02:20 PM   #3
Meinstad
Huge Clucker
 
Meinstad's Avatar
 
Join Date: Sep 2010
Location: Northpole
Posts: 364
Reputation: 31
Default Re: error 010: invalid function or declaration

pawn Code:
return true;
there is where my error is.

And yes, I've declared 'ftext'.
__________________
Meinstad is offline   Reply With Quote
Old 10/11/2011, 02:24 PM   #4
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,140
Reputation: 1127
Default Re: error 010: invalid function or declaration

Show us the entire function or a larger snippet of code surrounding the code you've already shown us.
Calgon is offline   Reply With Quote
Old 10/11/2011, 02:29 PM   #5
Meinstad
Huge Clucker
 
Meinstad's Avatar
 
Join Date: Sep 2010
Location: Northpole
Posts: 364
Reputation: 31
Default Re: error 010: invalid function or declaration

pawn Code:
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;
}
__________________
Meinstad is offline   Reply With Quote
Old 10/11/2011, 02:31 PM   #6
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,140
Reputation: 1127
Default Re: error 010: invalid function or declaration

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

pawn Code:
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.
Calgon is offline   Reply With Quote
Old 10/11/2011, 02:33 PM   #7
Meinstad
Huge Clucker
 
Meinstad's Avatar
 
Join Date: Sep 2010
Location: Northpole
Posts: 364
Reputation: 31
Default Re: error 010: invalid function or declaration

Okey thanks!
__________________
Meinstad is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 010: invalid function or declaration nissan123 Help Archive 6 20/08/2011 02:58 PM
error 010: invalid function or declaration iGetty Help Archive 8 05/08/2011 12:53 PM
error 010: invalid function or declaration Jamal' Help Archive 1 08/08/2010 06:57 PM
[HELP]error 010: invalid function or declaration endjuru Help Archive 2 21/04/2010 07:06 AM
: error 010: invalid function or declaration SEC Help Archive 2 29/06/2009 12:47 PM


All times are GMT. The time now is 07:59 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.