Format message
#9

Код:
#define BYTES_PER_CELL 				4

stock SFM(playerid, color, fstring[], {Float, _}:...)
{
    static const STATIC_ARGS = 3;
    new n = (numargs() - STATIC_ARGS) * BYTES_PER_CELL;
    if(n)
    {
        new message[144],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 -= BYTES_PER_CELL;
            #emit LOAD.S.pri      arg_end
        }
        while(arg_end > arg_start);

        #emit PUSH.S          fstring
        #emit PUSH.C          144
        #emit PUSH.ADR         message

        n += BYTES_PER_CELL * 3;
        #emit PUSH.S          n
        #emit SYSREQ.C         format

        n += BYTES_PER_CELL;
        #emit LCTRL          4
        #emit LOAD.S.alt        n
        #emit ADD
        #emit SCTRL          4

        if(playerid == INVALID_PLAYER_ID)
        {
            #pragma unused playerid
            return SendClientMessageToAll(color, message);
        } else {
            return SendClientMessage(playerid, color, message);
        }
    } else {
        if(playerid == INVALID_PLAYER_ID)
        {
            #pragma unused playerid
            return SendClientMessageToAll(color, fstring);
        } else {
            return SendClientMessage(playerid, color, fstring);
        }
    }
}
Credits to ******.
Reply


Messages In This Thread
Format message - by None1337 - 11.01.2018, 11:03
Re: Format message - by iLearner - 11.01.2018, 11:07
Re: Format message - by None1337 - 11.01.2018, 12:32
Re: Format message - by ISmokezU - 11.01.2018, 12:37
Re: Format message - by iLearner - 11.01.2018, 12:39
Re: Format message - by jasperschellekens - 11.01.2018, 12:40
Re: Format message - by ISmokezU - 11.01.2018, 12:53
Re: Format message - by None1337 - 11.01.2018, 13:41
Re: Format message - by DaniceMcHarley - 11.01.2018, 13:43
Re: Format message - by None1337 - 11.01.2018, 16:50

Forum Jump:


Users browsing this thread: 1 Guest(s)