Posts: 73
Threads: 14
Joined: Dec 2011
(EDIT): I've found an issue caused and linked to declaring several new variables on a same line.
The following code (for example) will compile just fine:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
new string[128];
return 1;
}
case 2:
{
new string[128];
return 1;
}
}
return 1;
}
However when changed to...
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
new DB:database, DBResult:result[2], dialog[1650], string[128], value[2][64], placeholder[3], target, time;
return 1;
}
case 2:
{
new string[128];
return 1;
}
}
return 1;
}
The error:
Код:
error 021: symbol already defined: "string"
Will appear, all because I made several new variables along with "new string[128]".
Posts: 2,593
Threads: 34
Joined: Dec 2007
so use only one new string[128]; above switch
Posts: 73
Threads: 14
Joined: Dec 2011
Quote:
Originally Posted by Jefff
so use only one new string[128]; above switch
|
Yeah, probably going to do that. Found the direct issue (and updated my original post), but it seems rather odd this would be happening.
Posts: 73
Threads: 14
Joined: Dec 2011
Quote:
Originally Posted by ******
Declaring variables in switch statements is known to have issues, have you tried Zeex's compiler?
|
No, I have not tried any other compilers.
This would be the one you are referring to, correct?
Posts: 73
Threads: 14
Joined: Dec 2011
14.06.2014, 19:47
(
Последний раз редактировалось DrakeX; 15.06.2014 в 05:15.
)
Downloaded the compiler, but stuck attempting to fix the -z issue. I've tried making a shortcut to 'pawno.exe' and adding the '-z' parameter into the 'target' and 'start in' field, only to have Windows tell me the following:
I've also tried adding -z inside and outside of the quotation marks, with no luck. Am I doing something wrong? Also, do I need to launch the application with a shortcut now? Because previously, I had windows associate .pwn files with pawno.exe, so I could just click and open them instantly, but I'm assuming that isn't possible now, because of the -z parameter requirement?
(EDIT): Attempted to add "-Z" to this line:
In settings.ini, but I'm receiving the error from the SSCANF include now as it didn't work.
Код:
fatal error 111: user error: Please include <a_npc> or <a_samp> first.
Posts: 73
Threads: 14
Joined: Dec 2011
15.06.2014, 16:46
(
Последний раз редактировалось DrakeX; 16.06.2014 в 04:29.
)
Thank you for that ******. It worked, however I found another compiler bug. I guess I'll send a message to Zeex about it. If you've got the code I posted above (second callback), it will still produce the error, and I found out that it is caused by declaring this:
Having (a multi-dimensional variable I think it's called) will cause the error to happen. I suppose I could fix this by using:
Код:
value1[64], value2[64]
instead.
(EDIT): Changing:
pawn Код:
new DB:database, DBResult:result[2], dialog[1650], string[128], value[2][64], placeholder[3], target, time;
to
pawn Код:
new value[2][64], DB:database, DBResult:result[2], dialog[1650], string[128], placeholder[3], target, time;
Will fix the compiling issue.