Jump to content

[CLEO] [SNIPPET] GetActorHandleBySAMPPlayerID


Tupi
 Share

Recommended Posts

Snippet:

 

R1:

:SAMPGetActorHandleBySAMPPlayerID
if 0AA2: 31@ = load_dynamic_library "samp.dll" // pSAMPBase
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

 

R2:

:SAMPGetActorHandleBySAMPPlayerID
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

 

R3:

:SAMPGetActorHandleBySAMPPlayerID
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

 

0.3DL:

:SAMPGetActorHandleBySAMPPlayerID
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

 

 

Exemplu: 

{$CLEO}

0000:
repeat
wait 50
until 0AFA:

0B34: "command" @command

WHILE TRUE
WAIT 0
END

:command
0B35: samp 0@ = get_last_command_params
if 0AD4: 33@ = scan_string 0@ format "%d" 1@
then
       if 0AB1: @SAMPGetActorHandleBySAMPPlayerID 1 SAMPPlayerID 1@ _StoreActorHandleTo 2@
       then
              00A0: store_actor 2@ position_to $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3
              00A1: put_actor $PLAYER_ACTOR at $TEMPVAR_FLOAT_1 $TEMPVAR_FLOAT_2 $TEMPVAR_FLOAT_3
              0AD1: show_formatted_text_highpriority "~g~TELEPORTED TO PLAYERDID %d" time 1000 1@
       end
else chatmsg "USE: /TeleportTo <Playerid>" -1
end
SAMP.CmdRet

 

Explicația:

Snippet-ul cauta actor handle-ul jucatorului pentru jucatorul cu ID-ul introdus de catre voi in toti jucatorii din raza voastra pe 350 unitati.

Acest snippet poate fi folosit intr-o multitudine de situații, când avem nevoie sa ne teleportam la pozitia lui, sa ne teleporteze in masina condusa de catre el, sa ii aflam culorile masinii condusa de catre el, etc.

Link to comment
Share on other sites

  • Nic locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.