Help i have problem with textdraw

madsinagestr

Active member
Joined
Oct 3, 2022
Messages
27
Reaction score
0
I try to make CLEO show name and hp same nametag wallhack when target player, but it not working properly. please help me
I use snippets on https://ugbase.eu/threads/cleo-some-snippets.16708/ . It would be great to put them in a text draw box like picture
image.png


this is my code :
Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP
While True
0001: wait 0 ms
    if
        0AB1: @GetPlayerTargetedEntity 0 _Return: TargetedActorHandle 1@
    then
        0AB1: @SetTextdrawStyle 2 ID 1000 Style 1 // Font
        
        0AB1: @GetPlayerNameByID 1 ID 1@ _Returned: Name 0@ // lay id           
        056D:   actor 1@ defined 
        02CB:   actor 1@ bounding_sphere_visible
        0AC8: 8@ = allocate_memory_size 260
        0AC8: 9@ = allocate_memory_size 260
        0AC8: 23@ = allocate_memory_size 260
        0AB1: @SAMPGetActorHealthByID 1 PlayerID 0@ _Returned: Health 18@ 
        0AB1: @GetPlayerNameByID 1 ID 0@ _Returned: Name 23@
        0AD3: 9@ = format "%s | %i" 23@ 0@ 
        0AD3: 8@ = format "Health: %d" 18@ 
        04C4: store_coords_to 11@ 12@ 13@ from_actor 1@ with_offset 0.0 0.0 0.0
        04C4: store_coords_to 20@ 21@ 22@ from_actor 1@ with_offset 0.0 0.0 0.0
        0AB1: @Convert3DposTo2Dscreen 3 XYZ 11@ 12@ 13@ ScreenXY 11@ 12@
        0AB1: @Convert3DposTo2Dscreen 3 XYZ 20@ 21@ 22@ ScreenXY 20@ 21@
        0AB1: @CreateTextdraw 4 ID 1000 Text 8@ XY 11@ 12@
        0AB1: @CreateTextdraw 4 ID 1000 Text 9@ XY 20@ 21@
        0AC9: free_allocated_memory 23@
        0AC9: free_allocated_memory 8@
        0AC9: free_allocated_memory 9@
    end

end // end while

:Convert3DposTo2Dscreen
{
    0xB6FA2C - CAMERA VIEW MATRIX
    input: 0@ 1@ 2@ xyz world coordinates
    output: 0@ 1@ xy screen coordinates (640x448)
    0AB1: @Convert3DposTo2Dscreen 3 XYZ 0@ 1@ 2@ ScreenXY 0@ 1@
}
// x = _x * _11 + _y * _21 + _z * _31 + 1 * _41
0007: 10@ = 0.0 // l=i (float)

0087: 3@ = 0@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA2C size 4 vp 0 // _11
006B: 3@ *= 4@ // l*=l (float)
005B: 10@ += 3@  // l+=l (float)

0087: 3@ = 1@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA3C size 4 vp 0 // _21
006B: 3@ *= 4@ // l*=l (float)
005B: 10@ += 3@  // l+=l (float)

0087: 3@ = 2@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA4C size 4 vp 0 // _31
006B: 3@ *= 4@ // l*=l (float)
005B: 10@ += 3@  // l+=l (float)

0A8D: 4@ = read_memory 0xB6FA5C size 4 vp 0 // _41
005B: 10@ += 4@  // l+=l (float)

// y = _x * _12 + _y * _22 + _z * _32 + 1 * _42
0007: 11@ = 0.0 // l=i (float)

0087: 3@ = 0@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA30 size 4 vp 0 // _12
006B: 3@ *= 4@ // l*=l (float)
005B: 11@ += 3@  // l+=l (float)

0087: 3@ = 1@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA40 size 4 vp 0 // _22
006B: 3@ *= 4@ // l*=l (float)
005B: 11@ += 3@  // l+=l (float)

0087: 3@ = 2@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA50 size 4 vp 0 // _32
006B: 3@ *= 4@ // l*=l (float)
005B: 11@ += 3@  // l+=l (float)
                                
0A8D: 4@ = read_memory 0xB6FA60 size 4 vp 0 // _42
005B: 11@ += 4@  // l+=l (float)

// z = _x * _13 + _y * _23 + _z * _33 + 1 * _43
0007: 12@ = 0.0 // l=i (float)

0087: 3@ = 0@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA34 size 4 vp 0 // _13
006B: 3@ *= 4@ // l*=l (float)
005B: 12@ += 3@  // l+=l (float)

0087: 3@ = 1@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA44 size 4 vp 0 // _23
006B: 3@ *= 4@ // l*=l (float)
005B: 12@ += 3@  // l+=l (float)

0087: 3@ = 2@ // l=l (float)
0A8D: 4@ = read_memory 0xB6FA54 size 4 vp 0 // _33
006B: 3@ *= 4@ // l*=l (float)
005B: 12@ += 3@  // l+=l (float)

0A8D: 4@ = read_memory 0xB6FA64 size 4 vp 0 // _43
005B: 12@ += 4@  // l+=l (float)

// x *= 640.0 / z
// y *= 448.0 / z
0007: 0@ = 640.0 // l=i (float)
0007: 1@ = 448.0 // l=i (float)

006B: 0@ *= 10@ // l*=l (float)
006B: 1@ *= 11@ // l*=l (float)

0073: 0@ /= 12@ // l/=l (float)
0073: 1@ /= 12@ // l/=l (float)
0AB2: 2 0@ 1@




:SetTextdrawText
{
    0AC8: 0@ = allocate_memory_size 1024
    0AD3: 0@ = format "Magic is Real!"
    0AB1: @SetTextdrawText 2 ID 1000 Text 0@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _returned: ID 17@
    IF 17@ > 0
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            0A8E: 31@ = 31@ + 0x21A0F8 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3CD // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x10 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: 31@ = 31@ + 0x21A100 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3C5 // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 3 // 0.3.DL
        THEN   
            0A8E: 31@ = 31@ + 0x2ACA24 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 4 // 0.3.7 R3
        THEN
            0A8E: 31@ = 31@ + 0x26E8DC // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: 31@ = 31@ + 0x26EA0C // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 31@ = 31@ + 0x26EA0C // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x1C // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: 31@ = 31@ + 0x26EB94 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x1C // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8D: 30@ readMem 31@ sz 4 vp 0
        END
        IF 30@ == TRUE
        THEN
            31@ += 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            IF 31@ > 0
            THEN 0AA7: call_function 0x718660 num_params 2 pop 2 source 1@ destination 31@ _Returned: value 30@ // Gta Strcpy
            END
        END
    END
END
0AB2: 0

:SetTextdrawStyle
{
    0AB1: @SetTextdrawStyle 2 ID 1000 Style 1
    Styles:
    1---4 - txd fonts (client)
    5 - model
    Other types may crash or not display.
}
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _returned: ID 17@
    IF 17@ > 0
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            0A8E: 31@ = 31@ + 0x21A0F8 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3CD // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x10 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: 31@ = 31@ + 0x21A100 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3C5 // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 3 // 0.3.DL
        THEN   
            0A8E: 31@ = 31@ + 0x2ACA24 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 4 // 0.3.7 R3
        THEN
            0A8E: 31@ = 31@ + 0x26E8DC // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: 31@ = 31@ + 0x26EA0C // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 31@ = 31@ + 0x26EA0C // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x1C // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8E: 27@ = 31@ + 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 27@ readMem 27@ sz 1 vp 0 // READ FIRST BYTE - SECURITY_CHECK
            IF 27@ > 0
            THEN 0A8D: 30@ readMem 31@ sz 4 vp 0
            ELSE 30@ = 0
            END
        END
      
        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: 31@ = 31@ + 0x26EB94 // SAMP_INFO_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x3DE // SAMP_PPOOLS_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            31@ += 0x1C // SAMP_PPOOL_TEXTDRAW_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            0@ *= 0x4 // TEXTDRAW_ID * 4
            005A: 31@ += 0@
            0A8D: 30@ readMem 31@ sz 4 vp 0
        END
        IF 30@ == TRUE
        THEN
            31@ += 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
            0A8D: 31@ readMem 31@ sz 4 vp 0
            IF 31@ > 0
            THEN
                0A8E: 29@ = 31@ + 0x987 // SAMP_TEXTDRAW_STYLE_OFFSET
                0A8C: writeMem 29@ sz 1 vl 1@ vp 0
            END
        END
    END
END
0AB2: 0
            
:GetPlayerNameByID
{
    0.3.DL
    IF 0AB1: @GetPlayerNameByID 1 ID 0@ _Returned: Name 1@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    0A8E: 30@ = 31@ + 0x2ACA24 // SAMP_INFO_OFFSET 
    0A8D: 30@ = readMem 30@ sz 4 vp 0
    30@ += 0x3DE // SAMP_PPOOLS_OFFSET         
    0A8D: 30@ = readMem 30@ sz 4 vp 0
    30@ += 0x8 // SAMP_PPOOL_PLAYER_OFFSET         
    0A8D: 30@ = readMem 30@ sz 4 vp 0

    0A8E: 29@ = 31@ + 0x170D0 // SAMP_GET_PLAYER_NAME_OFFSET

    0AA8: call_function_method 29@ struct 30@ num_params 1 pop 0 0@ _Returned: Name 28@
    IF 28@ > 0
    THEN 0485:  RETURN_TRUE
    ELSE 059A:  RETURN_FALSE
    END
END
0AB2: 1 28@

:SAMPGetActorHealthByID
{
    0.3.DL
    0AB1: @SAMPGetActorHealthByID 1 PlayerID 995 _Returned: Health 1@
}
IF 0AA2: 1@ = "samp.dll"
THEN
    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@ += 0x26 // SAMP_REMOTEPLAYER_OFFSET
    005A: 1@ += 0@
    0A8D: 1@ readMem 1@ sz 4 vp 0
    IF 1@ > 0
    THEN
        1@ += 0x8 // SAMP_REMOTEPLAYERDATA_OFFSET
        0A8D: 1@ readMem 1@ sz 4 vp 0
        IF 1@ > 0
        THEN
            1@ += 0x1B0 // SAMP_REMOTEPLAYERDATA_HEALTH_OFFSET
            0A8D: 1@ readMem 1@ sz 4 vp 0
            IF NOT 1@ < 0
            THEN 0485:  return_true
            ELSE 059A:  return_false
            END
        ELSE 059A:  return_false
        END
    ELSE 059A:  return_false
    END
END
0AB2: 1 1@

:SetTextdrawPosition
{
    0.3.DL
    0AB1: @SetTextdrawPosition 3 ID 1000 XY 320.0 224.0
}
IF 0AA2: 31@ = "samp.dll"
THEN
    31@ += 0x2ACA24 // SAMP_INFO_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0
    31@ += 0x3DE // SAMP_PPOOLS_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0
    31@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
    0A8D: 31@ readMem 31@ sz 4 vp 0
    0@ *= 0x4 // TEXTDRAW_ID * 4
    005A: 31@ += 0@
    0A8D: 30@ readMem 31@ sz 4 vp 0
    IF 30@ == TRUE
    THEN
        31@ += 0x2400  // SAMP_TEXTDRAW_STRUCT_OFFSET
        0A8D: 31@ readMem 31@ sz 4 vp 0
        IF 31@ > 0
        THEN
            0A8E: 29@ = 31@ + 0x98B // SAMP_TEXTDRAW_POSITION_X_OFFSET
            0A8C: writeMem 29@ sz 4 vl 1@ vp 0
            0A8E: 28@ = 31@ + 0x98F // SAMP_TEXTDRAW_POSITION_Y_OFFSET
            0A8C: writeMem 28@ sz 4 vl 2@ vp 0
        END
    END
END
0AB2: 0

:CreateTextdraw
{
    0.3.DL
    0AC8: 0@ = allocate_memory_size 1024
    0AD3: 0@ = format "Textdraw.."
    0AB1: @CreateTextdraw 4 ID 1000 Text 0@ XY 320.0 224.0
}
IF 0AA2: 31@ = "samp.dll"
THEN
    0AC8: 30@ = allocate_memory_size 66
    0A8C: write_memory 30@ size 2 value 18 virtual_protect 1
    30@ += 0x1
    0A8C: write_memory 30@ size 4 value 0.25 virtual_protect 1 // fLetterWidth
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 1.0 virtual_protect 1 // fLetterHeight
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 0xFFFFFFFF virtual_protect 1 // letterColor
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 0.0 virtual_protect 1 // fBoxWidth
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 0.0 virtual_protect 1 // fBoxHeight
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 0xFF000000 virtual_protect 1 // boxColor
    30@ += 0x4
    0A8C: write_memory 30@ size 1 value 0 virtual_protect 1 // nShadow
    30@ += 0x1
    0A8C: write_memory 30@ size 1 value 0 virtual_protect 1 // bOutline
    30@ += 0x1
    0A8C: write_memory 30@ size 4 value 0xFF000000 virtual_protect 1 // m_backgroundColor
    30@ += 0x4
    0A8C: write_memory 30@ size 1 value 1 virtual_protect 1 // m_nStyle
    30@ += 0x1
    0A8C: write_memory 30@ size 1 value 0 virtual_protect 1 // unknown
    30@ += 0x1
    0A8C: write_memory 30@ size 4 value 2@ virtual_protect 1 // m_fX
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 3@ virtual_protect 1 // m_fY
    30@ += 0x4
    0A8C: write_memory 30@ size 2 value 0 virtual_protect 1 // m_nModel
    30@ += 0x2
    0A8C: write_memory 30@ size 4 value 0.0 virtual_protect 1 // m_rotationX
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 0.0 virtual_protect 1 // m_rotationY
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 0.0 virtual_protect 1 // m_rotationZ
    30@ += 0x4
    0A8C: write_memory 30@ size 4 value 0.0 virtual_protect 1 // m_fZoom
    30@ += 0x4
    0A8C: write_memory 30@ size 2 value 0xFF virtual_protect 1 // m_aColor[0]
    30@ += 0x2
    0A8C: write_memory 30@ size 2 value 0xFF virtual_protect 1 // m_aColor[1]
    30@ -= 61 // go back to the original pointer.

    0A8E: 29@ = 31@ + 0x2ACA24 // SAMP_INFO_OFFSET
    0A8D: 29@ readMem 29@ sz 4 vp 0
    29@ += 0x3DE // SAMP_PPOOLS_OFFSET
    0A8D: 29@ readMem 29@ sz 4 vp 0
    29@ += 0x20 // SAMP_PPOOL_TEXTDRAW_OFFSET
    0A8D: 29@ readMem 29@ sz 4 vp 0

    0A8E: 28@ = 31@ + 0x1E3D0 //SAMP_CREATE_TEXTDRAW_OFFSET
    0AA6: call_method 28@ struct 29@ num_params 3 pop 0 Text 1@ pTransmit 30@ ID 0@  _retVal 6@
END
0AB2: 0
:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: id 0@
30@ = 0
IF 0AA2: 31@ = load_library "samp.dll" // IF and SET
THEN
    31@ += 0x128
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
    IF 29@ == 0x5542F47A
    THEN // 0.3.7 R1
        30@ = 1
    END

    IF 29@ == 0x59C30C94
    THEN // 0.3.7 R2
        30@ = 2
    END

    IF 29@ == 0x5A6A3130
    THEN // 0.3.DL
        30@ = 3
    END

    31@ -= 8 // reading samp.dll + 0x120
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1

    IF 29@ == 0x5C0B4243
    THEN // 0.3.7 R3
        30@ = 4
    END

    IF 29@ == 0x5DD606CD
    THEN // 0.3.7 R4
        30@ = 5
    END
END
0AB2: ret 1 30@

:GetPlayerTargetedEntity
{
    if
    0AB1: @GetPlayerTargetedEntity 0 _Return: TargetedActorHandle 0@
    then
        // do something...
    end
}
0470: 30@ = actor $PLAYER_ACTOR current_weapon
30@ *= 0x70
30@ += 0xC8AAB8
30@ += 0x8
0A8D: 30@ = read_memory 30@ size 4 virtual_protect 0 // weapon range

    0A96: 0@ = actor $PLAYER_ACTOR struct
    0A8D: 1@ = read_memory 0xB6F1A8 size 2 virtual_protect 0 // TheCamera.m_aCams.m_wCamMode
    0AA6: call_method 0x5E4280 struct 0@ num_params 3 pop 0 bIncludeAnim 1 iBoneID 25 vPosition 2@v // CPed__getBonePosition
    000B: 4@ += 0.3
    if or
        0039:   1@ == 53
        0039:   1@ == 55
    then
        0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 _targetOut 5@v _cameraOut 8@v _z 4@ _y 3@ _x 2@ _range 30@ // CCamera::Find3rdPersonCamTargetVector
    else
        068E: get_camera_target_point_to 5@ 6@ 7@
        068D: get_camera_position_to 8@ 9@ 10@
        0087: 11@ = 8@ // (float)
        0087: 12@ = 9@ // (float)
        0087: 13@ = 10@ // (float)
      
        0063: 11@ -= 5@  // (float)
        0063: 12@ -= 6@  // (float)
        0063: 13@ -= 7@  // (float)
      
        0087: 14@ = 11@ // (float)
        0087: 15@ = 12@ // (float)
        0087: 16@ = 13@ // (float)
      
        0013: 11@ *= 30@
        0013: 12@ *= 30@
        0013: 13@ *= 30@
      
        0087: 5@ = 8@ // (float)
        0087: 6@ = 9@ // (float)
        0087: 7@ = 10@ // (float)

        0063: 5@ -= 11@  // (float)
        0063: 6@ -= 12@  // (float)
        0063: 7@ -= 13@  // (float)
      
        0063: 8@ -= 14@ // (float)
        0063: 9@ -= 15@ // (float)
        0063: 10@ -= 16@ // (float)

    end
    0006: 1@ = 0 // entity = NULL
    0AA7: call_function 0x56BA00 num_params 12 pop 12 0 0 0 0 _objects 1 _peds 1 _vehicles 1 _buildings 1 _pEntity 1@v _colPoint 8@v _end 5@v _start 2@v _result: 13@ // CWorld::ProcessLineOfSight
    0006: 14@ = 0
    0006: 15@ = 0
  
    if
    1@ <> 0
    then
        0A8E: 2@ = 1@ + 0x36 // 1@ Entity struct
        0A8D: 2@ = read_memory 2@ size 1 virtual_protect 0 // entity->m_nStatusType
        0B10: 2@ = 2@ AND 7
        if
        2@ == 3 // ENTITY_TYPE_PED
        then
            0A96: 31@ = actor $PLAYER_ACTOR struct
            if
            803B:   not 31@ == 1@  // (int)
            then
                0AEA: 15@ = actor_struct 1@ handle
            end
        end
    end

if 056D:   actor 15@ defined
then 0485:  return_true
else 059A:  return_false
end
0AB2: ret 1 15@
 

Hidend

Expert
Joined
Mar 4, 2013
Messages
656
Reaction score
50
I guess you need to delete your textdraw once you don't find a valid target, perhaps @Parazitas can convert this cpp codee to do so:

void DeleteTextDraw(uint16_t nId) { ((void(__thiscall *)(stTextdrawPool *, uint16_t))(g_dwSAMP_Addr + 0x1AD00))(g_SAMP->pPools->pTextdraw, nId); }
 

madsinagestr

Active member
Joined
Oct 3, 2022
Messages
27
Reaction score
0
I guess you need to delete your textdraw once you don't find a valid target, perhaps @Parazitas can convert this cpp codee to do so:

void DeleteTextDraw(uint16_t nId) { ((void(__thiscall *)(stTextdrawPool *, uint16_t))(g_dwSAMP_Addr + 0x1AD00))(g_SAMP->pPools->pTextdraw, nId); }
And the display of player name + health not correctly
 

madsinagestr

Active member
Joined
Oct 3, 2022
Messages
27
Reaction score
0
I'm busy until Monday
Maybe after i will get little free time
thank you for reply me and I wait you to finish work.
I describe problems with that cleo:
  • the display of player name + health + color not correctly
  • the textdraw not hide when i untarget player
  • i hope you put textdraw on the character's head
  • If possible, can you make it work with all players within 200m without Target?
 
Top