Getting error while creating stock for ShowPlayerDialog -
WellDone - 20.01.2013
Hi everyone.
For my purposes, I need to have the current stock in my mod:
pawn Код:
stock ShowDialog(playerid, dialogid, style, caption[], info[], button1[], button2[])
{
OnDialog[playerid]=1;
ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]); //1484
return 1;
}
(because in this mod before each dialog
OnDialog[playerid]=1; must be put and I want to create this stock to free myself from this)
But I'm getting this:
pawn Код:
C:\SAMP\mod1.pwn(1484) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
What is actually wrong with the code?
Thanks in advance.
Re: Getting error while creating stock for ShowPlayerDialog -
LarzI - 20.01.2013
Remove the squared brackets in ShowPlayerDialog.
pawn Код:
stock ShowDialog(playerid, dialogid, style, caption[], info[], button1[], button2[])
{
OnDialog[playerid]=1;
ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2); //1484
return 1;
}
However, why don't you just use a macro instead?
pawn Код:
#define ShowDialog(%0,%1,%2,%3,%4,%5,%6) OnDialog[%0]=1;ShowPlayerDialog(%0,%1,%2,%3,%4,%5,%6)
Re: Getting error while creating stock for ShowPlayerDialog -
WellDone - 20.01.2013
Quote:
Originally Posted by LarzI
Remove the squared brackets in ShowPlayerDialog.
pawn Код:
stock ShowDialog(playerid, dialogid, style, caption[], info[], button1[], button2[]) { OnDialog[playerid]=1; ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2); //1484 return 1; }
|
Thanks, worked.
Quote:
Originally Posted by LarzI
However, why don't you just use a macro instead?
pawn Код:
#define ShowDialog(%0,%1,%2,%3,%4,%5,%6) OnDialog[%0]=1;ShowPlayerDialog(%0,%1,%2,%3,%4,%5,%6)
|
This one didn't work. Having a bunch of errors with "unreachable code", "invalid expression" and so on if I use this definition.
Re: Getting error while creating stock for ShowPlayerDialog -
[XST]O_x - 20.01.2013
Try this:
pawn Код:
#define ShowDialog(%0,%1,%2,%3[],%4[],%5[],%6[]) OnDialog[%0]=1;ShowPlayerDialog(%0,%1,%2,%3,%4,%5,%6)
Re: Getting error while creating stock for ShowPlayerDialog -
WellDone - 20.01.2013
Quote:
Originally Posted by [XST]O_x
Try this:
pawn Код:
#define ShowDialog(%0,%1,%2,%3[],%4[],%5[],%6[]) OnDialog[%0]=1;ShowPlayerDialog(%0,%1,%2,%3,%4,%5,%6)
|
nope, getting "Undefined symbol ShowDialog" for each line after this.
I'll better stick with my fixed stock, because it's working.
Re: Getting error while creating stock for ShowPlayerDialog -
LarzI - 20.01.2013
Quote:
Originally Posted by [XST]O_x
Try this:
pawn Код:
#define ShowDialog(%0,%1,%2,%3[],%4[],%5[],%6[]) OnDialog[%0]=1;ShowPlayerDialog(%0,%1,%2,%3,%4,%5,%6)
|
Ah yes forgot the brackets. Anyway if the function works, there's no "need" to use a macro instead, but a macro would be slightly faster.
Re: Getting error while creating stock for ShowPlayerDialog -
WellDone - 21.01.2013
Quote:
Originally Posted by LarzI
Ah yes forgot the brackets. Anyway if the function works, there's no "need" to use a macro instead, but a macro would be slightly faster.
|
As I said, this macro doesn't work even with brackets. Getting undefined for each "ShowDialog" line.
But whatever, all is good with the stock.