SA-MP Forums Archive
Invalid function or declaration errors :( - 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: Invalid function or declaration errors :( (/showthread.php?tid=320680)



Invalid function or declaration errors :( - lion950 - 24.02.2012

Hello, i have 2 "Invalid function or declaration errors" and can't compile my script now. Here are the errors:

D:\Games\GTA San Andreas\pawno\include\PPC_Defines.inc(23 : error 010: invalid function or declaration
D:\Games\GTA San Andreas\pawno\include\PPC_Defines.inc(240) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

And here is the script:


// Create some global variables that are used to display large dialogs
{new DialogMsg5000 //Line 238
}
; //Line 240



I am sure it is a bracket missed or added and it has a simple solution but i can't just solve it. Please I know you can help me .I am new at scripting.


Re: Invalid function or declaration errors :( - doreto - 24.02.2012

show as full line of code what we cant understand on line 240 ;


Re: Invalid function or declaration errors :( - lion950 - 24.02.2012

it has ; because i was trying different possibilities with brackets and these..; Here it is how the code continues:

// Create some global variables that are used to display large dialogs
{new DialogMsg5000
}
;

// These variables are only used during the GameModeInit, they are used for debugging purposes
// A variable to hold the ID of every vehicle (used to record the last ID of a vehicle, for debugging)
new LastVehicleID;
// A variable to hold the ID of every object (used to record the last ID of an object, for debugging)
new LastObjectID;
// A variable to hold the total amount of houses that are loaded
new TotalHouses;
// A variable that holds the last speedcam-id
new TotalCameras;
// A variable that holds the total amount of businesses loaded
new TotalBusiness;


Re: Invalid function or declaration errors :( - JiHost - 24.02.2012

I guess it should be like this.

Код:
{
new DialogMsg[5000];
}



Re: Invalid function or declaration errors :( - lion950 - 24.02.2012

Now the following errors occured :
D:\Games\GTA San Andreas\pawno\include\PPC_Defines.inc(23 : error 010: invalid function or declaration
D:\Games\GTA San Andreas\pawno\include\PPC_Defines.inc(240) : error 054: unmatched closing brace ("}")

I can't stand what could it be..


Re: Invalid function or declaration errors :( - Twisted_Insane - 24.02.2012

First of all, show me your whole command you created, and then, comment the line where the error appears!
And please use these tags: [ pawn][/pawn]

(Without the spaces)


Re: Invalid function or declaration errors :( - lion950 - 24.02.2012

This is actually PPC Trucking Mode and what cannot be compiled is the file PPC Defines. I haven't made any changes on it but it shows errors even though i replaced it with the original file from the mode. In this file there are only defined things with no commands:

pawn Код:
....// Define messagecolors
#define ColorRed 0xFF0000FF
#define ColorGreen 0x00FF00FF
#define ColorBlue 0x0000FFFF

// Define Virtual Worlds
#define WORLD_JAIL 10254

// Define options for admins
#define AutoKickAfterWarn           1 // Define if the player gets kicked after a certain amount of warnings
#define AutoKickWarnings            3 // Define the amount of warnings before a player is kicked automatically



// Define spectate modes
#define ADMIN_SPEC_TYPE_NONE 0
#define ADMIN_SPEC_TYPE_PLAYER 1
#define ADMIN_SPEC_TYPE_VEHICLE 2

// Create some global variables that are used to display large dialogs
new DialogMsg5000[5000];                      [COLOR="Red"]this is where the error appears[/COLOR]


// These variables are only used during the GameModeInit, they are used for debugging purposes
// A variable to hold the ID of every vehicle (used to record the last ID of a vehicle, for debugging)
new LastVehicleID;
// A variable to hold the ID of every object (used to record the last ID of an object, for debugging)
new LastObjectID;
// A variable to hold the total amount of houses that are loaded
new TotalHouses;
// A variable that holds the last speedcam-id
new TotalCameras;
// A variable that holds the total amount of businesses loaded
new TotalBusiness;
I am sorry guys but i am new at the forum and still don't know these basic things.


Re: Invalid function or declaration errors :( - Twisted_Insane - 24.02.2012

What is this for, if I may ask?

pawn Код:
[COLOR="Red"]
Delete that, and also the closing tag which is connected with it!


Re: Invalid function or declaration errors :( - lion950 - 24.02.2012

I used this in order to make the font red and show you more clearly where the error is, but as you see it didn't work.


Re: Invalid function or declaration errors :( - Twisted_Insane - 24.02.2012

Oh, lol, sorry, thought it was from your gamemode! Okay look, the string is too big, it's 5000! The maximum size is 1024, that's why I would set it to 512 or 1024!

If this still didn't work, read the error again: You have got an unmatching closing(opening) bracket in your script, which isn't connected to anywhere! Show me the line 240, that means, the whole code with line 240 included!