How to get general information about a player?

Aincrad

Member
Joined
Jun 4, 2018
Messages
17
Reaction score
4
Hello good, does anyone have a snippet that allows me to obtain information such as PING, Position, Life, ID and Name of the player that I write down?


I mean get the basic information of the player that I write down.

Thanks in advance .
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Hello good, does anyone have a snippet that allows me to obtain information such as PING, Position, Life, ID and Name of the player that I write down?


I mean get the basic information of the player that I write down.

Thanks in advance .
Download and install Sampfuncs on both your game and sannybuilder, this are the Opcodes you will need for your script:
Code:
0B25: samp 2@ = get_player_health 1@
0B26: samp 3@ = get_player_armor 1@
0B2A: samp 4@ = get_player_ping 1@
0B36: samp 5@ = get_player_nickname 1@
0B37: samp 6@ = get_player_color 1@
0B2F: samp get_streamed_out_player_pos 1@ to 8@ 9@ 10@ // if the player is out of stream, you can get his location by this
00A0: store_actor 7@ position_to 8@ 9@ 10@ // if the player is streaming, get its handle then get the position


// some useful opcodes
0B2B: samp 1@ = get_player_id_by_actor_handle 7@  // <--- Handle to ID convert
0B20: samp 7@ = actor_handle_by_samp_player_id 1@ // <--- ID to Handle convert
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
in C ++? I don't use Cleo.
Oh yeah I forgot, so stupid I am xD

I remember a topic of mine where @0x_ shared a C++ sourcecode that gets a samp player health in integer format.
C++:
SAMPPTR_POOLS_PLAYER = 0x21A0F8(read ptr) + 0x3CD (read ptr) + 0x18
SAMP::CSAMPPlayer SAMP::CPlayerPool::GetSAMPPlayerAt(PLAYERID playerid)
{
    return CSAMPPlayer(*(Address*)(SAMPM->ResolvePtr(SAMPPTR_POOLS_PLAYER) + 4 * playerid + 46), playerid);
}

float SAMP::CSAMPPlayer::GetHealth()
{
    Address pPlayerData = (Address)NWMem::Read<Address*>(m_this);
    return NWMem::Read<float>(pPlayerData + 0x1BC);
}

// To obtain the playerid by GTA:SA Ped you can call 0x10420 of SAMPPTR_POOLS_PLAYER (params: void* this(POOLS_PLAYER), DWORD ped ptr
 
Top