CLEO Help Help, auto press the specific key when pressing 1 key.

CLEO related
Status
Not open for further replies.

ha.sh

Active member
Joined
Nov 14, 2018
Messages
66
Reaction score
0
Hello, is cleo possible to make player/user automated pressing the specific key when pressing 1 key?

For example: When i pressed "X" it will be automatically pressing "SPACE" twice.
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
x::send {space 2}
He meant a Cleo script, not an autohotkey script, also you need to insert a small delay so that gta sa keyboard hook can intercept it
Code:
#persistent
setkeydelay,300,300
return

~x::
send {space 2}
return



Hello, is cleo possible to make player/user automated pressing the specific key when pressing 1 key?

For example: When i pressed "X" it will be automatically pressing "SPACE" twice.


Code:
{$CLEO .cs}
0000: press space twice when x was pressed by ajom

while true
    wait 0
    if 0AB0:   key_pressed 88 // X
    then
             0AB1: @Set_Virtual_Key 2 KeyOffSet 0x20 time 250
             0AB1: @Set_Virtual_Key 2 KeyOffSet 0x20 time 250
              while 0AB0:   key_pressed 88 // anti-key spam X
                        wait 0
              end
    end
end

:Set_Virtual_Key // ripped from Parazitas (http://ugbase.eu/index.php?threads/snippet-set-virtual-or-game-key.19933/)
// 0AB1: @Set_Virtual_Key 2 KeyOffSet 0x125 time 800
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@  // (int)
0A8C: write_memory 2@ size 1 value 255 virtual_protect 0
wait 1@
0A8C: write_memory 2@ size 1 value 0 virtual_protect 0
0AB2: ret 0
 

ha.sh

Active member
Joined
Nov 14, 2018
Messages
66
Reaction score
0
He meant a Cleo script, not an autohotkey script, also you need to insert a small delay so that gta sa keyboard hook can intercept it
Code:
#persistent
setkeydelay,300,300
return

~x::
send {space 2}
return






Code:
{$CLEO .cs}
0000: press space twice when x was pressed by ajom

while true
    wait 0
    if 0AB0:   key_pressed 88 // X
    then
             0AB1: @Set_Virtual_Key 2 KeyOffSet 0x20 time 250
             0AB1: @Set_Virtual_Key 2 KeyOffSet 0x20 time 250
              while 0AB0:   key_pressed 88 // anti-key spam X
                        wait 0
              end
    end
end

:Set_Virtual_Key // ripped from Parazitas (http://ugbase.eu/index.php?threads/snippet-set-virtual-or-game-key.19933/)
// 0AB1: @Set_Virtual_Key 2 KeyOffSet 0x125 time 800
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@  // (int)
0A8C: write_memory 2@ size 1 value 255 virtual_protect 0
wait 1@
0A8C: write_memory 2@ size 1 value 0 virtual_protect 0
0AB2: ret 0
thanks! i'll try later
 
Status
Not open for further replies.
Top