SAMP Get Actor Handle Using Player ID

Code:
:SAMPGetActorHandleByPlayerID // 0AB1: @SAMPGetActorHandleByPlayerID 1 _PlayerID 0@ _StoreActorHandle 25@
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase // no need to Free Memory
then
    31@ += 0x21A0F8
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3CD
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0x18
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stPlayerPool
            if 31@ > 0
            then
                0A8D: 30@ = read_memory 31@ size 4 virtual_protect 0 // ulMaxPlayerIDStreamedOnly
                if 002D: 30@ >= 0@ // within the max streamed ID
                then
                    31@ += 0x4
                    0A8D: 30@ = read_memory 31@ size 2 virtual_protect 0 // sLocalPlayerID
                    if 003B: 0@ == 30@ // Same ID
                    then
                        0485: return_true
                        0AB2: cleo_return 1 $PLAYER_ACTOR
                    else
                        31@ += 0x2A // pRemotePlayer[0]
                        0A90: 30@ = 0@ * 4
                        005A: 31@ += 30@ // pRemotePlayer[0@]
                        0A8E: 30@ = 31@ + 0xFB0 // iIsListed[0@]
                        0A8D: 30@ = read_memory 30@ size 4 virtual_protect 0 // iIsListed
                        if 30@ == true
                        then
                            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // pRemotePlayer
                            if 31@ > 0
                            then
                                0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // pPlayerData
                                if 31@ > 0
                                then
                                    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // pSAMP_Actor
                                    if 31@ > 0
                                    then
                                        31@ += 0x44
                                        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // pGTA_PedHandle
                                        if 056D: actor 31@ defined
                                        then
                                            0485: return_true
                                            0AB2: cleo_return 1 31@
                                        end
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end
059A: return_false
0AB2: cleo_return 1 -1
Type the word BLINK, and you will teleport on Streamed Player 4
Code:
{$CLEO}
0000:

while true
    wait 0
    if 0ADC: test_cheat "BLINK"
    then
        if 0AB1: @SAMPGetActorHandleByPlayerID 1 _PlayerID 4 _StoreActorHandle 1@ // get Actor Handle of player ID "4"
        then
            00A0: store_actor 1@ position_to 0@ 1@ 2@
            00A1: put_actor $PLAYER_ACTOR at 0@ 1@ 2@
            0ACD: show_text_highpriority "~g~TP Successful!" time 1000
        else 0ACD: show_text_highpriority "~r~Player not Streamed!" time 1000
        end
    end
end
 
Last edited:

mpol77

Active member
Joined
Oct 24, 2018
Messages
66
Reaction score
6
Tried this for 0.3DL, something's wrong

PHP:
:SAMPGetActorHandleByPlayerID // 0AB1: @SAMPGetActorHandleByPlayerID 1 _PlayerID 0@ _StoreActorHandle 25@
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase // no need to Free Memory
then
    31@ += 0x2ACA24
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPInfo
    if 31@ > 0
    then
        31@ += 0x3DE
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stSAMPPools
        if 31@ > 0
        then
            31@ += 0x8
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // stPlayerPool
            if 31@ > 0
            then
                0A8D: 30@ = read_memory 31@ size 4 virtual_protect 0 // ulMaxPlayerIDStreamedOnly
                if 002D: 30@ >= 0@ // within the max streamed ID
                then
                    31@ += 0x0
                    0A8D: 30@ = read_memory 31@ size 2 virtual_protect 0 // sLocalPlayerID
                    if 003B: 0@ == 30@ // Same ID
                    then
                        0485: return_true
                        0AB2: cleo_return 1 $PLAYER_ACTOR
                    else
                        31@ += 0x26 // pRemotePlayer[0]
                        0A90: 30@ = 0@ * 4
                        005A: 31@ += 30@ // pRemotePlayer[0@]
                        0A8E: 30@ = 31@ + 0xFA8 // iIsListed[0@]
                        0A8D: 30@ = read_memory 30@ size 4 virtual_protect 0 // iIsListed
                        if 30@ == true
                        then
                            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // pRemotePlayer
                            if 31@ > 0
                            then
                                0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // pPlayerData
                                if 31@ > 0
                                then
                                    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // pSAMP_Actor
                                    if 31@ > 0
                                    then
                                        31@ += 0x40
                                        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // pGTA_PedHandle
                                        if 056D: actor 31@ defined
                                        then
                                            0485: return_true
                                            0AB2: cleo_return 1 31@
                                        end
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end
059A: return_false
0AB2: cleo_return 1 -1
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
0.3.7 R2
PHP:
:SAMPGetActorHandleByPlayerID
{
    0.3.7 R2
    IF 0AB1: @SAMPGetActorHandleByPlayerID 1 _PlayerID 0@ _Returned: Handle 31@
}
IF 0AA2: 31@ = loadlib "samp.dll" // GET_SAMP_BASE
THEN
    31@ += 0x21A100 // SAMP_INFO_OFFSET[0]
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_INFO
    IF 31@ > 0
    THEN
        31@ += 0x3C5 // SAMP_POOLS_OFFSET[0]
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_POOLS_OFFSET
        IF 31@ > 0
        THEN
            31@ += 0x8 // PLAYER_POOLS_OFFSET[0]
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // PLAYER_POOLS
            IF 31@ > 0
            THEN
                0A8E: 30@ = 31@ + 0x0 // LOCAL_PLAYER_ID_OFFSET[0]
                0A8D: 30@ = read_memory 30@ size 2 virtual_protect 0 // LOCAL_PLAYER_ID
                IF 003B: 0@ == 30@ // COMPARE_ID_WHICH_WAS_GIVEN
                THEN
                    0AB2: RET 1 $PLAYER_ACTOR
                ELSE
                    0A8E: 29@ = 31@ + 0x22 // 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@ + 0x26 // 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@ += 0xC // PLAYER_DATA_OFFSET[0]
                            0A8D: 26@ = read_memory 26@ size 4 virtual_protect 0 // PLAYER_DATA
                            IF 26@ > 0
                            THEN
                                26@ += 0x1C // 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@ == 28@ // COMPARE_ID_WHICH_WAS_GIVEN
                                        THEN
                                            0485: RETURN_TRUE
                                            0AB2: RET 1 26@
                                        END
                                    END
                                END
                            END
                        END
                    END
                END
            END
        END
    END
END
059A: RETURN_FALSE
0AB2: RET 0
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
0.3.7 R3
PHP:
:SAMPGetActorHandleByPlayerID
{
    0.3.7 R3
    IF 0AB1: @SAMPGetActorHandleByPlayerID 1 _PlayerID 0@ _Returned: Handle 31@
}
IF 0AA2: 31@ = loadlib "samp.dll" // GET_SAMP_BASE
THEN
    31@ += 0x26E8DC // SAMP_INFO_OFFSET[0]
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_INFO
    IF 31@ > 0
    THEN
        31@ += 0x3DE // SAMP_POOLS_OFFSET[0]
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_POOLS_OFFSET
        IF 31@ > 0
        THEN
            31@ += 0x8 // PLAYER_POOLS_OFFSET[0]
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // PLAYER_POOLS
            IF 31@ > 0
            THEN
                0A8E: 30@ = 31@ + 0x2F1C // LOCAL_PLAYER_ID_OFFSET[0]
                0A8D: 30@ = read_memory 30@ size 2 virtual_protect 0 // LOCAL_PLAYER_ID
                IF 003B: 0@ == 30@ // COMPARE_ID_WHICH_WAS_GIVEN
                THEN
                    0AB2: RET 1 $PLAYER_ACTOR
                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@ + 0x4 // 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@ == 28@ // COMPARE_ID_WHICH_WAS_GIVEN
                                        THEN
                                            0485: RETURN_TRUE
                                            0AB2: RET 1 26@
                                        END
                                    END
                                END
                            END
                        END
                    END
                END
            END
        END
    END
END
059A: RETURN_FALSE
0AB2: RET 0
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
0.3.DL
PHP:
:SAMPGetActorHandleByPlayerID
{
    0.3.DL
    IF 0AB1: @SAMPGetActorHandleByPlayerID 1 _PlayerID 0@ _Returned: Handle 31@
}
IF 0AA2: 31@ = loadlib "samp.dll" // GET_SAMP_BASE
THEN
    31@ += 0x2ACA24 // SAMP_INFO_OFFSET[0]
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_INFO
    IF 31@ > 0
    THEN
        31@ += 0x3DE // SAMP_POOLS_OFFSET[0]
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_POOLS_OFFSET
        IF 31@ > 0
        THEN
            31@ += 0x8 // PLAYER_POOLS_OFFSET[0]
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // PLAYER_POOLS
            IF 31@ > 0
            THEN
                0A8E: 30@ = 31@ + 0x0 // LOCAL_PLAYER_ID_OFFSET[0]
                0A8D: 30@ = read_memory 30@ size 2 virtual_protect 0 // LOCAL_PLAYER_ID
                IF 003B: 0@ == 30@ // COMPARE_ID_WHICH_WAS_GIVEN
                THEN
                    0AB2: RET 1 $PLAYER_ACTOR
                ELSE
                    0A8E: 29@ = 31@ + 0x22 // 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@ + 0x26 // 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@ += 0x8 // PLAYER_DATA_OFFSET[0]
                            0A8D: 26@ = read_memory 26@ size 4 virtual_protect 0 // PLAYER_DATA
                            IF 26@ > 0
                            THEN
                                26@ += 0x4 // 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@ == 28@ // COMPARE_ID_WHICH_WAS_GIVEN
                                        THEN
                                            0485: RETURN_TRUE
                                            0AB2: RET 1 26@
                                        END
                                    END
                                END
                            END
                        END
                    END
                END
            END
        END
    END
END
059A: RETURN_FALSE
0AB2: RET 0
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
0.3.7 R4 - v2
PHP:
:SAMPGetActorHandleByPlayerID
{
    0.3.7 R4 - v2
    IF 0AB1: @SAMPGetActorHandleByPlayerID 1 _PlayerID 0@ _Returned: Handle 31@
}
IF 0AA2: 31@ = loadlib "samp.dll" // GET_SAMP_BASE
THEN
    31@ += 0x26E8DC // SAMP_INFO_OFFSET[0]
    0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_INFO
    IF 31@ > 0
    THEN
        31@ += 0x3DE // SAMP_POOLS_OFFSET[0]
        0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // SAMP_POOLS_OFFSET
        IF 31@ > 0
        THEN
            31@ += 0x8 // PLAYER_POOLS_OFFSET[0]
            0A8D: 31@ = read_memory 31@ size 4 virtual_protect 0 // PLAYER_POOLS
            IF 31@ > 0
            THEN
                0A8E: 30@ = 31@ + 0x2F1C // LOCAL_PLAYER_ID_OFFSET[0]
                0A8D: 30@ = read_memory 30@ size 2 virtual_protect 0 // LOCAL_PLAYER_ID
                IF 003B: 0@ == 30@ // COMPARE_ID_WHICH_WAS_GIVEN
                THEN
                    0AB2: RET 1 $PLAYER_ACTOR
                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@ + 0x4 // 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@ == 28@ // COMPARE_ID_WHICH_WAS_GIVEN
                                        THEN
                                            0485: RETURN_TRUE
                                            0AB2: RET 1 26@
                                        END
                                    END
                                END
                            END
                        END
                    END
                END
            END
        END
    END
END
059A: RETURN_FALSE
0AB2: RET 0
 
Last edited:

SamThapa

Active member
Joined
Jan 22, 2018
Messages
82
Reaction score
2
this all script not working as i am trying to get player handle is there any other way to get ?


forgot to mention its UIF server
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
this all script not working as i am trying to get player handle is there any other way to get ?


forgot to mention its UIF server
Provide Server ip and account please.
I'm gonna test myself
 

SamThapa

Active member
Joined
Jan 22, 2018
Messages
82
Reaction score
2
"Provide Server ip" > ok

"and account please" > normaly who gives their account to anyone ? create your self
I'm gonna test myself > Sure do that

its

Hostname: UIF - United Islands Freeroam
Address: 94.23.145.137:7776
Players: 186/1000
Mode: UIF Freeroam
Language: English
Site: uifserver.net
 
Top