SA-MP Forums Archive
How to get "{Float,_}:..." parameters? - 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: How to get "{Float,_}:..." parameters? (/showthread.php?tid=600806)



How to get "{Float,_}:..." parameters? - amirm3hdi - 13.02.2016

For example, I have a function like this:

Код:
forward my_printf(format[], {Float,_}:...)
public my_printf(format[], {Float,_}:...)
{
    return printf(format, {Float,_}:...);
}
It errors... How to get each variable, or use them?

Thanks


Re: How to get "{Float,_}:..." parameters? - AbyssMorgan - 13.02.2016

I found such a hook on printf
You can use it
PHP код:
stock AC_printf(const fmat[], {Float_}:...) {
    static 
output[128], frm_header[3];
    const 
output_size sizeof(output);
    
#emit LCTRL      5
    #emit CONST.alt  frm_header
    #emit MOVS       12
    #emit ADD.C    12
    #emit SCTRL    4
    #emit PUSH.C      output_size
    #emit PUSH.C      output
    #emit LOAD.S.pri  8
    #emit ADD.C       8
    #emit PUSH.pri
    #emit SYSREQ.C    format
    #emit LCTRL       5
    #emit SCTRL       4
    #emit MOVE.alt
    #emit CONST.pri   frm_header
    #emit MOVS        12
    #emit LOAD.S.pri  8
    #emit ADD.C       12
    #emit MOVE.alt
    #emit LCTRL       5
    #emit ADD
    #emit LOAD.I
    #emit STOR.S.pri  20
    //your function
    
static debugmsg[128];
    
format(debugmsg,128,"DBG: %s",output);
    
MSGToAdmins(-1debugmsgtrueLEVEL_ADMIN3);
    
    return print(
output);
    
#pragma unused fmat
}
//hook
#if defined _ALS_printf
    #undef printf
#else
    #define _ALS_printf
#endif
#define printf AC_printf 
I do not understand how it works, but it works: D


Re: How to get "{Float,_}:..." parameters? - BroZeus - 13.02.2016

https://sampwiki.blast.hk/wiki/Getarg
https://sampwiki.blast.hk/wiki/Numargs


Re: How to get "{Float,_}:..." parameters? - amirm3hdi - 13.02.2016

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
I found such a hook on printf
You can use it

I do not understand how it works, but it works: D
No, printf was just an Example...

ANYONE ELSE?


Re: How to get "{Float,_}:..." parameters? - amirm3hdi - 13.02.2016

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
Thanks, I'll look it up.