CLEO Help Cleo spam key

CLEO related

Huydaik987

New member
Joined
Dec 11, 2022
Messages
1
Reaction score
0
I want to write Cleo when the z key is pressed, the z key is pressed once every two seconds. when pressing the x key, the z key stops working
 

Juli4n

Active member
Joined
Mar 31, 2021
Messages
43
Solutions
1
Reaction score
19
Location
Argentina
Not tested..
Code:
{$CLEO .cs}

0000:

while 8AFA:
    wait 0
end

while true
    wait 0
    if 8B8C:  not samp is_cursor_active
    then
        if 0AB0:   key_pressed 90 {Z}
        then
            while 0AB0:   key_pressed 90 {Z}
                wait 0
            end
            // Run
            while 8AB0:  not key_pressed 88 {X}
                wait 0
                0AB1: call_scm_func @KeyPress 2 Key 90{Z} Time 100
                0BFE: 31@ = get_tick_count
                31@ += 2000 // 2 seconds
                while true
                    wait 0
                    0BFE: 30@ = get_tick_count
                    if or
                    002D:   30@ >= 31@
                    0AB0:   key_pressed 88 {X}
                    then
                        break
                    end
                end
            end
        end
    end
end

:KeyPress
if 0AA2: 2@ = load_library "User32.dll"
then
    if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
    then
        0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
        wait 1@
        0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
    end
end
0AB2: ret 0
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
The guy above done it already ok :D
Not tested..
Code:
{$CLEO .cs}

0000:

while 8AFA:
    wait 0
end

while true
    wait 0
    if 8B8C:  not samp is_cursor_active
    then
        if 0AB0:   key_pressed 90 {Z}
        then
            while 0AB0:   key_pressed 90 {Z}
                wait 0
            end
            // Run
            while 8AB0:  not key_pressed 88 {X}
                wait 0
                0AB1: call_scm_func @KeyPress 2 Key 90{Z} Time 100
                0BFE: 31@ = get_tick_count
                31@ += 2000 // 2 seconds
                while true
                    wait 0
                    0BFE: 30@ = get_tick_count
                    if or
                    002D:   30@ >= 31@
                    0AB0:   key_pressed 88 {X}
                    then
                        break
                    end
                end
            end
        end
    end
end

:KeyPress
if 0AA2: 2@ = load_library "User32.dll"
then
    if 0AA4: 2@ = get_proc_address "keybd_event" library 2@
    then
        0AA5: call 2@ num_params 4 pop 0 0 0 0 0@
        wait 1@
        0AA5: call 2@ num_params 4 pop 0 0 0x02 0 0@
    end
end
0AB2: ret 0

Small thing about that snippet, it will keep pressing on windows that key if player using anti pause / samp addon..

I highly recommend better use in game key pressing..
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
458
Solutions
9
Reaction score
166
Location
Poland
Small thing about that snippet, it will keep pressing on windows that key if player using anti pause / samp addon..

I highly recommend better use in game key pressing..
 
Top