SA-MP Forums Archive
Help for error 001: variables - 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: Help for error 001: variables (/showthread.php?tid=597225)



Help for error 001: variables - StevenPhp - 28.12.2015

Hello.

I shall like testing a filterscript but this one has errors during the compilation.
Код:
error 001: expected token: "{", but found "-integer value-"
error 001: expected token: "}", but found ";"
Код HTML:
new  HoldingButton[MAX_PLAYERS][2] = 0;
new	PlayerButtonTimer[MAX_PLAYERS];
The error comes from this first variable.

The author of the filterscript had made like that:
Код HTML:
new
    HoldingButton[MAX_PLAYERS][2] = 0,
    PlayerButtonTimer[MAX_PLAYERS]
;
I found no problem similar to variables of this type on the Internet.

Thank you for your help !


Re: Help for error 001: variables - Kaliber - 28.12.2015

Look at this:

PHP код:
HoldingButton[MAX_PLAYERS][2] = 0
You can't do that, this way...but actually you dont need it, cause variables (in pawn) automaticly initialized with zero.

So just write it like this:

PHP код:
new  HoldingButton[MAX_PLAYERS][2];
new    
PlayerButtonTimer[MAX_PLAYERS]; 
PS: If you want to initialisize an Array, it would look like this:

PHP код:
//For 1 Dimension
new test[5] = {0, ...};
//For 2 Dimensions:
new test[5][2] = {
    {
0,0},
    {
0,0},
    {
0,0},
    {
0,0},
    {
0,0}
}; 
and so on


Re: Help for error 001: variables - StevenPhp - 28.12.2015

Simply...
I had not understood that he had used a syntax of array but that there was no array.

Thank you!