SA-MP Forums Archive
Macros problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Macros problem (/showthread.php?tid=172000)



[ Fixed ] Macros problem - Scottas - 28.08.2010

pawn Код:
#define     SetPlayerPosCircle(%0,%1,%2,%3,%4)      \
                new                                 \
                    rr = random ( %4 ),             \
                    ra = random ( 360 );            \
                SetPlayerPos ( %0, %1 + ( floatsin ( ra, degrees ) * rr ) , %2 + ( floatcos ( ra, degrees ) * rr ) , %3 )
Why I get error, when I'm trying to use this function?

pawn Код:
#define     MAIN_SPAWN      0.0, 0.0, 6.0

SetPlayerPosCircle ( playerid, MAIN_SPAWN, 5 );
Error:
Код:
error 017: undefined symbol "SetPlayerPosCircle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
what's wrong with this?


Re: Macros problem - Voldemort - 28.08.2010

on top

forward SetPlayerPosCircle(playerid,MainSpawn,value);

somewhere under main(), but not in it

public SetPlayerPosCircle(playerid,MainSpawn,value)
{
new rr = random ( %4 ),ra = random ( 360 );
SetPlayerPos (playerid, %0, %1 + ( floatsin ( ra, degrees ) * rr ) , %2 + ( floatcos ( ra, degrees ) * rr ) , %3 )

Or your strange script
}


Re: Macros problem - [XST]O_x - 28.08.2010

I don't believe you can use multiple arguments on one definition.

pawn Код:
#define MAIN_SPAWN1 0.0
#define MAIN_SPAWN2 0.0
#define MAIN_SPAWN3 6.0


SetPlayerPosCircle ( playerid, MAIN_SPAWN1,MAIN_SPAWN2,MAIN_SPAWN3, 5 );



Re: Macros problem - Scottas - 28.08.2010

I can, I've tryed to change, but it did't solve my problem.


Re: Macros problem - Scottas - 28.08.2010

Fixed, just needed to change, like Voldemort said. It gives an error, when I am trying to use MAIN_SPAWN in this defined function, but simple 'SetPlayerPos ( playerid, MAIN_SPAWN );' works fine.