• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] I need help with Assembly (#emit or __emit)
#2
Try this

PHP Code:
native CallLocalFunction(const funcname[], const format[], {Float,_}:...);
native printf(const output[], {Float,_}:...);


stock __CallLocalFunction(const funcname[], const format[], {Float,_}:...) {
    static retval;


    if (funcidx(funcname) == -1) {

        retval = 0;
        printf("Function not defined: %s.\n", funcname);
    } else {

        if (numargs() == 2) {

            retval = CallLocalFunction(funcname, format);
        } else {

            new arguments[128];
            formatex(arguments, sizeof(arguments), format);


            #emit __emit_function_call funcname arguments
        }
    }


    return retval;
}


public 
__emit_function_call(const funcname[], arguments[]) {
    new Function:func = funcidx(funcname);
    new result;

    switch (numargs(arguments)) {
        case 0: result = CallLocalFunction(funcname); break;
        case 1: result = CallLocalFunction(funcname, arguments[0]); break;
        case 2: result = CallLocalFunction(funcname, arguments[0], arguments[1]); break;

    }

    // Store the result
    retval = result;
} 
  Reply


Messages In This Thread
RE: I need help with Assembly (#emit or __emit) - by N0FeaR - 2024-03-04, 06:12 PM