{Float,_}:...
#12

Quote:
Originally Posted by ******
Посмотреть сообщение
Yes, that's the one. That takes a variable number of parameters and pushes them to printf.
I don't know how to do ... I tryed ~20 minutes and I don't know, the function don't work ...

That's the FS:
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <ysi/y_debug>

stock bool:False = false;

#define CreateStreamedObject CreateDynamicObject

#define DIALOG_EMPTY 3

public OnFilterScriptInit()
{

    return 1;
}

CMD:test(playerid, params[])
{
    new pName[ MAX_PLAYER_NAME ];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    FormatSCLMFS(playerid, -1, "Nickul tau este %s (ID: %d)", "Your nick is %s (ID: %s)", pName, playerid);
    return 1;
}

stock FormatSCLMFS(playerid, color, strRO[], strENG[], {Float,_}:...) <ysi_debug:on>
{
    // This uses the variable parameter passing method based on code by Zeex.
    // See page 15 of the code optimisations topic.
    new arguments = (numargs() - 1) * 4;
    if (arguments)
    {
        new
            arg_start,
            arg_end;

        // Load the real address of the last static parameter.  Do this by
        // loading the address of the parameter and then adding the value of
        // [FRM] (frame pointer).
        #emit CONST.alt                 playerid
        #emit CONST.alt                 color
        #emit CONST.alt                 strRO
        #emit CONST.alt                 strENG
        #emit LCTRL                     5
        #emit ADD
        #emit STOR.S.pri                arg_start

        // Load the address of the last variable parameter.  Do this by adding
        // the number of variables on the value just loaded.
        #emit LOAD.S.alt                arguments
        #emit ADD
        #emit STOR.S.pri                arg_end

        // Push the variable arguments.  This is done by loading the value of
        // each one in reverse order and pushing them.  I'd love to be able to
        // rewrite this to use the values of pri and alt for comparison, instead
        // of having or constantly reload two variables.
        do
        {
            #emit LOAD.I
            #emit PUSH.pri
            arg_end -= 4;
            #emit LOAD.S.pri            arg_end
        }
        while (arg_end > arg_start);

        // Push the static parameter.
        #emit PUSH.S                    playerid
        #emit PUSH.S                    color
        #emit PUSH.S                    strRO
        #emit PUSH.S                    strENG

        // Now push the number of parameters sent and call the function.
        arguments += 4;
        #emit PUSH.S                    arguments
        #emit SYSREQ.C                  SCLMFS

        // Clear the stack, including the return.
        arguments += 4;
        #emit LCTRL                     4
        #emit LOAD.S.alt                arguments
        #emit ADD
        #emit SCTRL                     4
    }
    else
    {
        SCLMFS(playerid, color, strRO, strENG);
    }
    return 1;
}

stock SCLMFS(playerid, color, ro[], eng[])
{
    switch(GetPVarInt(playerid,"Language"))
    {
        case 0: SendClientMessage(playerid, color, eng);
        case 1: SendClientMessage(playerid, color, ro);
    }
    return 1;
}
and a warning:
Код:
H:\Jocuri\server sa-mp 0.3\filterscripts\testinfparams.pwn(0) : warning 230: no implementation for state "off" in function "FormatSCLMFS", no fall-back
Reply


Messages In This Thread
{Float,_}:... - by IstuntmanI - 26.04.2011, 11:51
Re: {Float,_}:... - by xDeadlyBoy - 26.04.2011, 12:02
Re: {Float,_}:... - by IstuntmanI - 26.04.2011, 12:11
Re: {Float,_}:... - by xDeadlyBoy - 26.04.2011, 12:18
Re: {Float,_}:... - by [L3th4l] - 26.04.2011, 12:25
Re: {Float,_}:... - by IstuntmanI - 26.04.2011, 16:06
Re: {Float,_}:... - by MadeMan - 26.04.2011, 16:20
Re: {Float,_}:... - by IstuntmanI - 26.04.2011, 16:32
Re: {Float,_}:... - by Alby Fire - 26.04.2011, 16:34
Re: {Float,_}:... - by xDeadlyBoy - 26.04.2011, 16:40
Re: {Float,_}:... - by IstuntmanI - 26.04.2011, 17:00
Re: {Float,_}:... - by IstuntmanI - 26.04.2011, 18:34
Re: {Float,_}:... - by IstuntmanI - 29.04.2011, 16:19

Forum Jump:


Users browsing this thread: 1 Guest(s)