Getting ptr of samp player pool properties [C++]

szezy

New member
Joined
Mar 27, 2020
Messages
1
Reaction score
0
Location
Ukraine
From pseudocode of GetPlayerHealth i got this:

C++:
signed int __cdecl sub_470D80(int a1, int a2)
{
  unsigned __int16 v2; // ax
  int v3; // esi

  v2 = *(_WORD *)(a2 + 4);
  if ( v2 >= 0x3E8u )
    return 0;
  v3 = *(_DWORD *)(*((_DWORD *)dword_4F5FB8 + 2) + 4 * v2 + 154012);
  if ( !v3 )
    return 0;
  sub_403100((_DWORD *)a1, *(_DWORD *)(a2 + 8), &a2);
  *(_DWORD *)a2 = *(_DWORD *)(v3 + 10529);
  return 1;
}

But from samp plugin i want to change player health and do this: (test shit code)

C++:
cell AMX_NATIVE_CALL f_DebugPlayerInfo(AMX* amx, cell* params)
{
    unsigned __int16 v2; // ax
    int v3; // esi
    int health;

    v2 = *(WORD*)(0 + 4); // 0 - playerid
    v3 = *(DWORD*)(*((DWORD*)0x4F5FB8 + 2) + 4 * v2 + 154012);

    *(DWORD*)health = *(DWORD*)(v3 + 10529);

    // logprintf health

    return 1;
}

but i give crash (with float too)

What i should to do for change health?
Thx
 
Top