#emit, What's it? - 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: #emit, What's it? (
/showthread.php?tid=599182)
#emit, What's it? -
SystemX - 22.01.2016
Here what does the #emit codes do? What is happening here?
PHP код:
stock SendStaffMessage(color, const str[], {Float,_}:...)
{
static
args,
start,
end,
string[144]
;
#emit LOAD.S.pri 8
#emit STOR.pri args
if (args > 8)
{
#emit ADDR.pri str
#emit STOR.pri start
for (end = start + (args - 8); end > start; end -= 4)
{
#emit LREF.pri end
#emit PUSH.pri
}
#emit PUSH.S str
#emit PUSH.C 144
#emit PUSH.C string
#emit LOAD.S.pri 8
#emit ADD.C 4
#emit PUSH.pri
#emit SYSREQ.C format
#emit LCTRL 5
#emit SCTRL 4
foreach (new i : Player)
{
if ((!PlayerData[i][pDisableStaff]) && (PlayerData[i][pHelper] >= 1 || PlayerData[i][pAdmin] > 0)) {
SendClientMessage(i, color, string);
}
}
return 1;
}
foreach (new i : Player)
{
if ((!PlayerData[i][pDisableStaff]) && (PlayerData[i][pHelper] >= 1 || PlayerData[i][pAdmin] > 0)) {
SendClientMessage(i, color, str);
}
}
return 1;
}
Re: #emit, What's it? -
BiosMarcel - 22.01.2016
https://sampwiki.blast.hk/wiki/Keywords
irectives#.23emit
Re: #emit, What's it? -
Crayder - 22.01.2016
It calls pseudo-assembler code. It's not something you want to mess with as a beginner.
Re: #emit, What's it? -
Jack_SMalls - 22.01.2016
That code seems like it handles the formatting, although I'm not completely sure. If you want to do something like this and not have to hassle with the more complicated code, ****** has function vararg formatting in y_va.inc (in YSI).