Getting error while creating stock for ShowPlayerDialog
#1

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.
Reply
#2

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)
Reply
#3

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.
Reply
#4

Try this:
pawn Код:
#define ShowDialog(%0,%1,%2,%3[],%4[],%5[],%6[]) OnDialog[%0]=1;ShowPlayerDialog(%0,%1,%2,%3,%4,%5,%6)
Reply
#5

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.
Reply
#6

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.
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)