CLEO Help Get target ID

CLEO related

VINHDZ

Active member
Joined
Nov 14, 2020
Messages
53
Reaction score
0
Location
viet nam
Can someone help me with the code: when aiming at a Player and pressing the P button, that Player ID will be sent to 0@
 

huyhuy

Member
Joined
Oct 29, 2020
Messages
7
Reaction score
1
Location
VietNam
i guess you use 0.3.DL version

Code:
{$CLEO .cs}



0000:



wait 10000

while true

wait 0



   IF and

0256:   player $PLAYER_CHAR defined

0AB0:   key_pressed 77 {M}

    THEN                                                                                                                                                              

        0AB1: @SAMPGetTargetPlayerID 0 _Returned: PlayerID 10@        

        if 0AB1: @SAMPIsPlayerDefined 1 PlayerID 10@

          then

           0AC8: 24@ = allocate_memory_size 1024

            0AD3: 24@ = format "ID PLAYER  : %d." 10@

          0AB1: @Chatmsg 2 text 24@ color -1

         else

              0AC8: 24@ = allocate_memory_size 1024

            0AD3: 24@ = format "AIM AT THE PLAYER !."

            0AB1: @Chatmsg 2 text 24@ color -1

           end

     end

END





   

        :SAMPGetTargetPlayerID

{

    0.3.DL

    0AB1: @SAMPGetTargetPlayerID 0 _Returned: PlayerID 0@

}

IF 0AA2: 1@ = "samp.dll"

THEN

    1@ += 0x2ACA24 // SAMP_INFO_OFFSET

    0A8D: 1@ = readmem 1@ sz 4 vp 0

    1@ += 0x3DE // SAMP_POOLS_OFFSET

    0A8D: 1@ = readmem 1@ sz 4 vp 0

    1@ += 0x8 // SAMP_POOL_PLAYER_OFFSET

    0A8D: 1@ = readmem 1@ sz 4 vp 0

    1@ += 0x1E // SAMP_LOCAL_PLAYER_OFFSET

    0A8D: 1@ readMem 1@ sz 4 vp 0

    1@ += 0x189 // SAMP_TARGET_PLAYER_ID_OFFSET

    0A8D: 1@ readMem 1@ sz 2 vp 0

    IF AND

    NOT 1@ == 65535 // NOT TARGET

    NOT 1@ < 0 // CHECK FOR NEGATIVE ID

    THEN 0485:  return_true

    ELSE 059A:  return_false

    END

END

0AB2: ret 1 1@

   

:Chatmsg

{

    0.3.DL

    0AB1: @Chatmsg 2 text 1@ color -1

}

IF 0AA2: 31@ = "samp.dll"

THEN

    0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)

    0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;

    0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)

    IF 1@ == -1

    THEN 1@ = 0xFFFFFFFF

    ELSE IF 1@ < 0

    THEN 1@ = 0xFFFFFFFF

    END

    END

    0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 1@ 0 0@ 8

END

0AB2: 0



:SAMPIsPlayerDefined

{

    0.3.DL

    0AB1: @SAMPIsPlayerDefined 1 PlayerID 995

}

0AA2: 1@ = load_library "samp.dll"

1@ += 0x2ACA24 // SAMP_INFO_OFFSET

0A8D: 1@ readMem 1@ sz 4 vp 0

1@ += 0x3DE // SAMP_PPOOLS_OFFSET

0A8D: 1@ readMem 1@ sz 4 vp 0

1@ += 0x8 // SAMP_PPOOL_PLAYER_OFFSET

0A8D: 1@ readMem 1@ sz 4 vp 0

0@ *= 0x4 // PLAYER_ID * 4

0@ += 0xFDE

005A: 1@ += 0@

0A8D: 2@ readMem 1@ sz 4 vp 0

IF 2@ == TRUE

THEN 0485:  return_true

ELSE 059A:  return_false

END

0AB2: 0
 

VINHDZ

Active member
Joined
Nov 14, 2020
Messages
53
Reaction score
0
Location
viet nam
i guess you use 0.3.DL version

Code:
{$CLEO .cs}



0000:



wait 10000

while true

wait 0



   IF and

0256:   player $PLAYER_CHAR defined

0AB0:   key_pressed 77 {M}

    THEN                                                                                                                                                            

        0AB1: @SAMPGetTargetPlayerID 0 _Returned: PlayerID 10@      

        if 0AB1: @SAMPIsPlayerDefined 1 PlayerID 10@

          then

           0AC8: 24@ = allocate_memory_size 1024

            0AD3: 24@ = format "ID PLAYER  : %d." 10@

          0AB1: @Chatmsg 2 text 24@ color -1

         else

              0AC8: 24@ = allocate_memory_size 1024

            0AD3: 24@ = format "AIM AT THE PLAYER !."

            0AB1: @Chatmsg 2 text 24@ color -1

           end

     end

END





 

        :SAMPGetTargetPlayerID

{

    0.3.DL

    0AB1: @SAMPGetTargetPlayerID 0 _Returned: PlayerID 0@

}

IF 0AA2: 1@ = "samp.dll"

THEN

    1@ += 0x2ACA24 // SAMP_INFO_OFFSET

    0A8D: 1@ = readmem 1@ sz 4 vp 0

    1@ += 0x3DE // SAMP_POOLS_OFFSET

    0A8D: 1@ = readmem 1@ sz 4 vp 0

    1@ += 0x8 // SAMP_POOL_PLAYER_OFFSET

    0A8D: 1@ = readmem 1@ sz 4 vp 0

    1@ += 0x1E // SAMP_LOCAL_PLAYER_OFFSET

    0A8D: 1@ readMem 1@ sz 4 vp 0

    1@ += 0x189 // SAMP_TARGET_PLAYER_ID_OFFSET

    0A8D: 1@ readMem 1@ sz 2 vp 0

    IF AND

    NOT 1@ == 65535 // NOT TARGET

    NOT 1@ < 0 // CHECK FOR NEGATIVE ID

    THEN 0485:  return_true

    ELSE 059A:  return_false

    END

END

0AB2: ret 1 1@

 

:Chatmsg

{

    0.3.DL

    0AB1: @Chatmsg 2 text 1@ color -1

}

IF 0AA2: 31@ = "samp.dll"

THEN

    0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)

    0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;

    0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)

    IF 1@ == -1

    THEN 1@ = 0xFFFFFFFF

    ELSE IF 1@ < 0

    THEN 1@ = 0xFFFFFFFF

    END

    END

    0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 1@ 0 0@ 8

END

0AB2: 0



:SAMPIsPlayerDefined

{

    0.3.DL

    0AB1: @SAMPIsPlayerDefined 1 PlayerID 995

}

0AA2: 1@ = load_library "samp.dll"

1@ += 0x2ACA24 // SAMP_INFO_OFFSET

0A8D: 1@ readMem 1@ sz 4 vp 0

1@ += 0x3DE // SAMP_PPOOLS_OFFSET

0A8D: 1@ readMem 1@ sz 4 vp 0

1@ += 0x8 // SAMP_PPOOL_PLAYER_OFFSET

0A8D: 1@ readMem 1@ sz 4 vp 0

0@ *= 0x4 // PLAYER_ID * 4

0@ += 0xFDE

005A: 1@ += 0@

0A8D: 2@ readMem 1@ sz 4 vp 0

IF 2@ == TRUE

THEN 0485:  return_true

ELSE 059A:  return_false

END

0AB2: 0
Thank you
 
Last edited:
Top