SA-MP Forums Archive
SendClientMessageF Macro - 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: SendClientMessageF Macro (/showthread.php?tid=111858)



SendClientMessageF Macro - un4seen - 04.12.2009

Hi,
I need macro of SendClientMessageF(playerid, color, message, format{...})

I tried
Код:
new FALSE = false;
#define SendFormattedText(%1,%2,%3, %4) do{new sendfstring[128];format(sendfstring,128,(%3),%4);SendClientMessage((%1), (%2) ,sendfstring);}while(FALSE)
but it don't work.

Have maybe someone fixed macro?

Thx,
un4seen


Re: SendClientMessageF Macro - Correlli - 04.12.2009

pawn Код:
new
    FALSE = 0;
pawn Код:
#define SendClientMessageEx(%0,%1,%2,%3) \
do \
{ \
  new \
      string[128]; \
  if(strlen(%2) > 0) \
  { \
    format(string, sizeof(string), %2, %3); \
    SendClientMessage(%0, %1, string); \
  } \
} \
while(FALSE)
pawn Код:
// example with formatting:
new
    name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
SendClientMessageEx(playerid, 0xFFFFFFAA, "Your name is %s", name)
pawn Код:
// example without formatting:
SendClientMessageEx(playerid, 0xFFFFFFAA, "Hello.", 0)



Re: SendClientMessageF Macro - un4seen - 04.12.2009

Love you.

Works, thx!


Re: SendClientMessageF Macro - bogeymanEST - 04.12.2009

There shouldn't be a space after "%3," in the original code so it should be:
pawn Код:
new FALSE = false;
#define SendFormattedText(%1,%2,%3,%4) do{new sendfstring[128];format(sendfstring,128,(%3),%4);SendClientMessage((%1), (%2) ,sendfstring);}while(FALSE)