Macro 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)
+--- Thread: Macro problem (
/showthread.php?tid=357006)
Macro problem -
Steeve_Smith - 05.07.2012
Hey there
I'm trying to make a macro, like this one:
pawn Код:
#define SVR_ERR_MSG(%0,%1) SendClientMessage(%0, COLOR_RED, "(Server) >> " %1);
But with this kind of code:
pawn Код:
new string[128];
format(string, sizeof(string), "(Server) >> %s did this...", pName(playerid));
SendClientMessageToAll(COLOR_RED, string);
But I have no idea how to deal with the variables in maccro, and imagine if I had several variables, like pName(playerid), pName(targetid)...
I tried to make it, and I got this:
pawn Код:
#define SVR_MSG(%0, %1, %2) \
new string[128]; \
format(string, sizeof(string), "(Server) >>" %1); \
SendClientMessage(%0, -1, %1);
Does anyone know how to do that?
Thanks
Re: Macro problem -
RyDeR` - 05.07.2012
pawn Код:
new
g_szStr[144]
;
#define SendFormatMessage(%0,%1,%2) \
format(g_szStr,sizeof(g_szStr),%2),SendClientMessage((%0),(%1),g_szStr)
Use a global string.
Re : Macro problem -
Steeve_Smith - 05.07.2012
Thank you :P