error 010: invalid function or declaration - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: error 010: invalid function or declaration (
/showthread.php?tid=296199)
error 010: invalid function or declaration -
Meinstad - 10.11.2011
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.
Re: error 010: invalid function or declaration -
Calgon - 10.11.2011
Which line is the error on? And how have you declared 'ftext'?
Re: error 010: invalid function or declaration -
Meinstad - 10.11.2011
there is where my error is.
And yes, I've declared 'ftext'.
Re: error 010: invalid function or declaration -
Calgon - 10.11.2011
Show us the entire function or a larger snippet of code surrounding the code you've already shown us.
Re: error 010: invalid function or declaration -
Meinstad - 10.11.2011
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;
}
Re: error 010: invalid function or declaration -
Calgon - 10.11.2011
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.
Re: error 010: invalid function or declaration -
Meinstad - 10.11.2011
Okey thanks!