What is this?? - 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: What is this?? (
/showthread.php?tid=609530)
What is this?? -
Micko123 - 13.06.2016
So i started to edit this GameMode and i found one stock that i have no idea what is it for
PHP код:
stock SCMF(playerid,color,fstring[],{Float, _}:...)
{
new n=(numargs()-3)*4;
if(n)
{
new message[128],arg_start,arg_end;
#emit CONST.alt fstring
#emit LCTRL 5
#emit ADD
#emit STOR.S.pri arg_start
#emit LOAD.S.alt n
#emit ADD
#emit STOR.S.pri arg_end
do
{
#emit LOAD.I
#emit PUSH.pri
arg_end-=4;
#emit LOAD.S.pri arg_end
}
while(arg_end>arg_start);
#emit PUSH.S fstring
#emit PUSH.C 255
#emit PUSH.ADR message
n+=4*3;
#emit PUSH.S n
#emit SYSREQ.C format
n+=4;
#emit LCTRL 4
#emit LOAD.S.alt n
#emit ADD
#emit SCTRL 4
return SCM(playerid,color,message);
}
else return SCM(playerid,color,fstring);
}
Can someone explain me??
Re: What is this?? -
Misiur - 13.06.2016
It's a combination of SendClientMessage and format, so:
pawn Код:
SCMF(playerid, -1, "This %s doesn't require format", "string");
Re: What is this?? -
Micko123 - 13.06.2016
oh yeah. thank you i see it now
Re: What is this?? -
CaioTJF - 13.06.2016
Its send a formatted message.
SCMF(playerid, -1, "Your score is %d", GetPlayerScore(playerid));
Re: What is this?? -
Dayrion - 13.06.2016
Where do this come from, please? (for credits)
Someone can explain each line? This is so interesting. 'o'
Re: What is this?? -
iKarim - 13.06.2016
Not really so expert in #emit related things but I think I can explain it.
PHP код:
stock SCMF(playerid,color,fstring[],{Float, _}:...)
{
new n=(numargs()-3)*4;
if(n)
{
new message[128],arg_start,arg_end;
#emit CONST.alt fstring // storing fstring in ALT
#emit LCTRL 5
#emit ADD
#emit STOR.S.pri arg_start // storing ar_start in PRI
#emit LOAD.S.alt n // storing n in ALT
#emit ADD // PRI + ALT (I guess)
#emit STOR.S.pri arg_end // storing args_end in ALT
do
{
#emit LOAD.I
#emit PUSH.pri
arg_end-=4;
#emit LOAD.S.pri arg_end
}
while(arg_end>arg_start);
#emit PUSH.S fstring // Pushing arguments.
#emit PUSH.C 255 // Pushing arguments.
#emit PUSH.ADR message // Pushing arguments.
n+=4*3;
#emit PUSH.S n // Pushing arguments.
#emit SYSREQ.C format // Executing format with those arguments ^
n+=4;
#emit LCTRL 4
#emit LOAD.S.alt n
#emit ADD
#emit SCTRL 4
return SCM(playerid,color,message);
}
else return SCM(playerid,color,fstring);
}