Code:
:SAMPGetPlayerIDByActorHandle
{
0.3.7 R1
IF 0AB1: @SAMPGetPlayerIDByActorHandle 1 _ActorHandle 0@ _Returned: ID 31@
}
IF 0AA2: 31@ = loadlib "samp.dll" // GET_SAMP_BASE
THEN
31@ += 0x21A0F8 // SAMP_INFO_OFFSET[0]
0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_INFO
IF 31@ > 0
THEN
31@ += 0x3CD // SAMP_POOLS_OFFSET[0]
0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_POOLS_OFFSET
IF 31@ > 0
THEN
31@ += 0x18 // PLAYER_POOLS_OFFSET[0]
0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // PLAYER_POOLS
IF 31@ > 0
THEN
IF 003B: 0@ == $PLAYER_ACTOR // COMPARE_HANDLE_WHICH_WAS_GIVEN
THEN
0A8E: 30@ = 31@ + 0x4 // LOCAL_PLAYER_ID_OFFSET[0]
0A8D: 28@ = read_memory 30@ size 2 virtual_protect 0 // LOCAL_PLAYER_ID
0AB2: RET 1 28@
ELSE
0A8E: 29@ = 31@ + 0x0 // MAX_PLAYER_ID_STREAMED_ONLY_OFFSET[0]
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0 // MAX_PLAYER_ID_STREAMED_ONLY
FOR 28@ = 0 TO 29@ // FROM "0" TO "MAX_PLAYER_ID_STREAMED_ONLY"
27@ = 0x4 // SAVE VARIABLE "27@" AS DIGIT "4"
006A: 27@ *= 28@ // 4 * ID
0A8E: 26@ = 31@ + 0x2E // SAVE TO NEW "26@" VARIABLE "PLAYER_POOLS" + "REMOTE_PLAYER_OFFSET[0]"
005A: 26@ += 27@ // REMOTE_PLAYER_OFFSET + 4 * ID
0A8D: 26@ = read_memory 26@ size 4 virtual_protect 0 // REMOTE_PLAYER
IF 26@ > 0
THEN
26@ += 0x0 // PLAYER_DATA_OFFSET[0]
0A8D: 26@ = read_memory 26@ size 4 virtual_protect 0 // PLAYER_DATA
IF 26@ > 0
THEN
26@ += 0x0 // SAMP_ACTOR_OFFSET[0]
0A8D: 26@ = read_memory 26@ size 4 virtual_protect 0 // SAMP_ACTOR
IF 26@ > 0
THEN
26@ += 0x44 // GTA_PED_HANDLE_OFFSET[0]
0A8D: 26@ = read_memory 26@ size 4 virtual_protect 0 // GTA_PED_HANDLE
IF 26@ > 0
THEN
IF 003B: 0@ == 26@ // COMPARE_HANDLE_WHICH_WAS_GIVEN
THEN
0485: RETURN_TRUE
0AB2: RET 1 28@
END
END
END
END
END
END
END
END
END
END
END
059A: RETURN_FALSE
0AB2: RET 0
Code:
{$CLEO}
0000:
while true
wait 0
if 0AD2: 0@ = player $PLAYER_CHAR targeted_actor // IF and SET
then
if 0AB1: @SAMPGetPlayerIDByActorHandle 1 _ActorHandle 0@ _Returned: ID 31@
then 0AD1: show_formatted_text_highpriority "Targeted Actor's SAMP ID is %d" time 100 31@
else 0ACD: show_text_highpriority "Targeted Actor have no SAMP ID" time 100
end
else
if 0AB1: @SAMPGetPlayerIDByActorHandle 1 _ActorHandle 0@ _Returned: ID 31@
then 0AD1: show_formatted_text_highpriority "Your SAMP ID is %d" time 100 31@
else 0ACD: show_text_highpriority "Your have no SAMP ID" time 100
end
end
end