CLEO Help Instant Crosshair HUD Bug

CLEO related
Status
Not open for further replies.

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
Hello, I am trying to recreate an "Instant Crosshair" Script that accurately simulate the crosshair texture in screen, But I am having a problem showing the Default GTASA Crosshair. Can anyone point out where I did it wrong? I am sure that at hud.txd there is an texture named SITEM16.
Code:
{$CLEO}
0000: instant crosshair by ajom
03F0: enable_text_draw 1
0390: load_txd_dictionary "HUD"
038F: load_texture "SITEM16" as 77

while true
    wait 0
    if 80E1: not player $PLAYER_CHAR pressed_key 6 // aim weapon
    then
        0A8D: 0@ = read_memory 0xB6EC14 size 4 virtual_protect 0 // Crosshair X multiplier
        0@ *= 640.0
        0A8D: 1@ = read_memory 0xB6EC10 size 4 virtual_protect 0 // Crosshair Y multiplier
        1@ *= 448.0

        2@ = 64.0 // 64 pixels in width
        0A8D: 4@ = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X
        0093: 4@ = integer 4@ to_float
        4@ /= 640.0
        0073: 2@ /= 4@ // (float)

        3@ = 64.0 // 64 pixels in height
        0A8D: 4@ = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y
        0093: 4@ = integer 4@ to_float
        4@ /= 448.0
        0073: 3@ /= 4@ // (float)

        038D: draw_text 77 pos 0@ 1@ size 2@ 3@ rgba 255 255 255 255
    end
end
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
Show crosshair instantly, normally you need wait one sec until you see crosshair when aiming , this code make it show instantly!
PHP:
0@ readMem 5824985 sz 1 // Read only one time to get default value


// Write to set show crosshair instantly
writeMem 5824985 sz 1 vl 235 vp 1

// Write to set default value
writeMem 5824985 sz 1 vl 0@ vp 1
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
Show crosshair instantly, normally you need wait one sec until you see crosshair when aiming , this code make it show instantly!
PHP:
0@ readMem 5824985 sz 1 // Read only one time to get default value


// Write to set show crosshair instantly
writeMem 5824985 sz 1 vl 235 vp 1

// Write to set default value
writeMem 5824985 sz 1 vl 0@ vp 1
I like that, I will add this snippet on my crosshair script.

But I would like to clarify my goal, I want the crosshair to always be there even if I am not aiming the weapon. As example, I am trying to recreate the script on this video:

As you can see on the video, the crosshair does not disappear. But the problem on that script is that it uses a "custom hud crosshair" texture, but it is better to use the default GTA SA crosshair that is what I am doing on the script above. My problem is that the texture is always white. Any thoughts how to fix it?
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
Can you post pic of your results, i don't have time to run my pc because i working a lot, i have two hours after job make ready for other day.
So if you could post pic maybe i can solve it without running pc.
 
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
snippet perfect crosshair pos from 0x search in c++ snipps, draw 2 lines done
Oh, nice trick, drawing a 2d line horizontically and vertically is a good alternative. I will use this trick instead of relying on hud. But looking back on my goal, is it hopeless for the GTA SA crosshair to show up all the time? Thanks by the way.
 
Last edited:

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
Can you post pic of your results, i don't have time to run my pc because i working a lot, i have two hours after job make ready for other day.
So if you could post pic maybe i can solve it without running pc.
Crosshair HUD Bug


Solved using 2D lines, it's more cooler than I thought. Thank you all.
 

Attachments

  • crosshair bug.png
    crosshair bug.png
    718.7 KB · Views: 51
Status
Not open for further replies.
Top