02.12.2009, 16:56
A long time ago, I did this by Assembly and pointers, the pointers' way you already know, and here are the Assembly way with parameters calling too:
Yes, it worked because you were ID 0, and parameters were invalid, so it was 0 too.
Код:
DWORD function = 0xEXAMPLE; cell *params = (cell *)malloc(sizeof(cell) * FUNCTION_PARAM_COUNT + 1); *params = FUNCTION_PARAM_COUNT * 4; //params[0] is "paramscount * 4" cell retval; //example calling the firat parameter as 5: *(++params) = 5; //etc __asm { PUSH params PUSH 0 //"amx" can be 0, or, if you like, use gamemode's amx, whatever... CALL function MOV retval, EAX } free(params); logprintf("Return value: %d", retval);
Quote:
Originally Posted by MaVe - leeturl.de
Thanks, ******, but could you explain me why it worked perfectly with 1 parameter for IsPlayerConnected?
EDIT: I think I got that now, perhaps SA-MP's IsPlayerConnected native does not use pAMX which gets *playerid*, and since I only tried it alone (ID 0) it also worked with that. passing (AMX*, cell*) does work fine however, thanks |