24.01.2020, 15:51
Hello!
I've returned to SA:MP after quite some time now and I checked a script and found this.
From the usages of it, I see that this function is used to send messages with "variables" instead of formatting it and then sending the formatted message.
I just don't get what this #emit does. I tried to search for an emit preprocessor for C/C++(so I can get a general answer rather than a samp-related one), but can't find any results(There is a _emit keyword, which is not what this is).
It would be greatly appreciated if someone can briefly explain to me what that is. No complicated topics since I am just 14.
Have a nice day.
EDIT: If there is a "non-emit" alternative to do this, please let me know.
I've returned to SA:MP after quite some time now and I checked a script and found this.
PHP Code:
stock SendClientMessageEx(playerid, color, const text[], {Float, _}:...)
{
static
args,
str[144];
if ((args = numargs()) == 3)
{
SendClientMessage(playerid, color, text);
}
else
{
while (--args >= 3)
{
#emit LCTRL 5
#emit LOAD.alt args
#emit SHL.C.alt 2
#emit ADD.C 12
#emit ADD
#emit LOAD.I
#emit PUSH.pri
}
#emit PUSH.S text
#emit PUSH.C 144
#emit PUSH.C str
#emit PUSH.S 8
#emit SYSREQ.C format
#emit LCTRL 5
#emit SCTRL 4
SendClientMessage(playerid, color, str);
#emit RETN
}
return 1;
}
I just don't get what this #emit does. I tried to search for an emit preprocessor for C/C++(so I can get a general answer rather than a samp-related one), but can't find any results(There is a _emit keyword, which is not what this is).
It would be greatly appreciated if someone can briefly explain to me what that is. No complicated topics since I am just 14.
Have a nice day.
EDIT: If there is a "non-emit" alternative to do this, please let me know.