CLEO Help Do two things at once in CLEO.

CLEO related
Status
Not open for further replies.

Zin

Expert
Joined
Aug 1, 2013
Messages
1,734
Solutions
2
Reaction score
117
So I'm making a CLEO and I need to kind of do two things at the same time but I don't know how you could do it. So here's an example of what I'm asking about, Sprinting ( holding sprint key ) while sending messages to the chat with a 1 second wait between, the problem is that to sprint I would have to make a very fast loop of sending a fake key press of sprint but the 1 second wait will counteract this so is it possible that I could have the keypress loop and send message running at the same time without having to do two seperate CLEO files?
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,734
Solutions
2
Reaction score
117
So you mean like having a second cleo file and using global vars to make them work together?
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
52
Location
LongForgotten <-> 0x32789
I did it using get tick count
Code:
{$CLEO .cs}
 
0000:

var
3@ : Integer
0@ : Integer
end

3@ = -1
 
:main
    wait 0
    0BFE: 0@ = get_tick_count
    0C72: set_virtual_key 32 down true
    if
    3@ == -1
    then
    0BFE: 3@ = get_tick_count
    end
    0@ -= 1000
    if
    3@ < 0@
    then
        3@ = -1
        chatmsg "{FFFFFF}Blah blah" 1
    end
jump @main

try it urself it works and spam space key while each 1 second messaging blah blah


and you dont need to create a very fast loop of sprinting, you just said holding so all you need to do is: 0C72: set_virtual_key 32 down true, it will set the space key pressed and make gta sa think its holded down and if u press W it will auto sprint but if u press space again it will reset so you just have to put it in any loop which isnt as long as 1 second atleast 500 ms but whatever u dont need to spam hold key but u can if u dont want to break the space key holded down even for 1 sec
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,734
Solutions
2
Reaction score
117
Alright so I made my custom thread but it appears to have an issue in it where when I release the A or D keys the game lags out to the server connection screen. ( most likely anti crasher preventing the crash )


Code:
:sprint
wait 0
if or
    key_down 65
    key_down 68
THEN
    print "sprint" 100
    0AB1: @FAKE_KEYPRESS 1 _OFFSET_KEY_ 0x20
    jump @sprint
ELSE
    0A93: end_custom_thread
end
Am I ending my thread properly? it's suppose to just stop when I don't have A or D pressed down.
 
Status
Not open for further replies.
Top