About calling natives from C
#2

Well here how It's done in Assembly( i tested with random and worked ):

Код:
typedef unsigned long DWORD;

bool vm_IsPlayerConnected(int playerid)
{
  DWORD
    ADDR_IsPlayerConnected = 0x4637E0;
  bool
    value = false;
  _asm
  {
    push playerid
    call ADDR_IsPlayerConnected
    mov value, eax
  }
  return value;
}
If you have more then 1 param then push it in reverse order( that's how stack works )

If you have any problem, tell...

EDIT:

NOTE: C++ standard says that return value from function must always be in "eax", I dont think C standard says same... but SAMP is written in C++ so you dont have to worry :P
Reply


Messages In This Thread
About calling natives from C - by Streetplaya - 01.12.2009, 17:02
Re: About calling natives from C - by Google63 - 01.12.2009, 17:29
Re: About calling natives from C - by Streetplaya - 01.12.2009, 17:35
Re: About calling natives from C - by Google63 - 01.12.2009, 17:46
Re: About calling natives from C - by Streetplaya - 01.12.2009, 18:11
Re: About calling natives from C - by Google63 - 01.12.2009, 18:39
Re: About calling natives from C - by Streetplaya - 02.12.2009, 12:18
Re: About calling natives from C - by Toribio - 02.12.2009, 16:56
Re: About calling natives from C - by Incognito - 02.12.2009, 17:31
Re: About calling natives from C - by Streetplaya - 02.12.2009, 17:42

Forum Jump:


Users browsing this thread: 3 Guest(s)