How to get "{Float,_}:..." parameters?
#1

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
Reply
#2

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
Reply
#3

https://sampwiki.blast.hk/wiki/Getarg
https://sampwiki.blast.hk/wiki/Numargs
Reply
#4

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?
Reply
#5

Thanks, I'll look it up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)