CLEO Help combined cleos

CLEO related
Status
Not open for further replies.

davidel

Well-known member
Joined
Jan 17, 2020
Messages
207
Reaction score
7
Location
Germania
hello i tried to combine 2 cleos but didnt work cuz i am beginner..
{$CLEO .cs}
0000:
0AB1: call_scm_func @RUN_CLEO 1 AT LINE @FIRST
0B34: "txd" @FIRST

:SECOND
WHILE TRUE
wait 0
if and
31@ == TRUE
0B4C: samp is_dialog_active -1 // any dialog
THEN
0AC8: 0@ = allocate_memory_size 260
0BD8: samp get_dialog_caption 0@ /// Get dialot caption
IF
0C29: $NOT_USED = stristr string1 0@ string2 "Select"
THEN
0B49: samp set_current_dialog_list_item 0
0B47: samp close_current_dialog_with_button 1
END

IF
0C29: $NOT_USED = stristr string1 0@ string2 "Enter ammount"
THEN
0B4B: samp set_current_dialog_editbox_text "1@"
0B47: samp close_current_dialog_with_button 1
31@ = FALSE
END
END


:FIRST
WHILE TRUE
wait 0

1@ = 2246
if 0C5D: samp textdraw 1@ is_exists
then
alloc 2@ = 1024
0C5A: samp textdraw 2246 get_string_to 0@
0AC8: 1@ = allocate_memory_size 260
0AB1: @get_digits_to_print param_count 2 text 0@ memory_to_store_digits_as_text 1@
say 1@ //test
FREE 0@
end
0B43:


:RUN_CLEO
0A9F: 32@ = current_thread_pointer
000A: 32@ += 0x10
0A8D: 32@ = read_memory 32@ size 4 virtual_protect 0
0062: 32@ -= 0@
0AA7: call_function 0x464C20 num_params 1 pop 1 32@ 33@
005A: 32@ += 0@
000A: 33@ += 0x10
0A8C: write_memory 33@ size 4 value 32@ virtual_protect 0
000A: 33@ += 0x2C
for 32@ = 0 to 30
0A8C: write_memory 33@ size 4 value 1@(32@,30i) virtual_protect 0
000A: 33@ += 4
end
0AB2: ret 0

:get_digits_to_print
{
0@ = text
1@ = pointer to memory where digits will be stored as text
}
0C17: 31@ = strlen 0@
for 30@ = 0 to 31@
0085: 29@ = 0@ // copy pointer
005A: 29@ += 30@ // add offset (as the loop progresses it becomes pointers to first-last character)
0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1 // 28@ is the ascii number representing character
if and
28@ >= 0x30 // '0'
28@ <= 0x39 // '9'
then
0A8C: write_memory 1@ size 1 value 28@ virtual_protect 1
1@ += 1 // move to next address
end
end
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0
i colored the things i want to do
when i type /txd to get the number from the textdraw and put in the dialog with dialog_editbox
i dont know how to do that..
also if you could open the dialog it would be awesome..key=Y
 

davidel

Well-known member
Joined
Jan 17, 2020
Messages
207
Reaction score
7
Location
Germania
{$CLEO .cs}

THREAD 'ExamenTP'

0662: printstring "By Zin"
0662: printstring "UGBASE.EU"

REPEAT
WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "+" to_label @EXAMEN

WAIT 0
1@ = 2246
31@ == TRUE
IF AND
056D: actor $PLAYER_ACTOR defined
0C5D: samp textdraw 1@ is_exists
THEN
ALLOC 0@ = 1024
0C5A: samp textdraw 1@ get_string_to 0@
0AC8: 1@ = allocate_memory_size 260
0AB1: @get_digits_to_print param_count 2 text 0@ memory_to_store_digits_as_text 1@
0AB1: @Set_Virtual_Key 2 KeyOffSet 0x59 state 255
WAIT 30
0AB1: @Set_Virtual_Key 2 KeyOffSet 0x59 state 0
wait 100
0B4B: samp set_current_dialog_editbox_text 1@
0B47: samp close_current_dialog_with_button 1
31@ = FALSE
END

:EXAMEN
0B12: 31@ = 31@ XOR 1
SAMP.CmdRet()

:Set_Virtual_Key
{
255 = true
0 = false
0AB1: @Set_Virtual_Key 2 KeyOffSet 0x57 state 255
}
2@ = 0xB72CC8
0@ *= 2
005A: 2@ += 0@ // (int)
0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
0AB2: ret 0

:get_digits_to_print
{
0@ = text
1@ = pointer to memory where digits will be stored as text
}
0C17: 31@ = strlen 0@
for 30@ = 0 to 31@
0085: 29@ = 0@ // copy pointer
005A: 29@ += 30@ // add offset (as the loop progresses it becomes pointers to first-last character)
0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1 // 28@ is the ascii number representing character
if and
28@ >= 0x30 // '0'
28@ <= 0x39 // '9'
then
0A8C: write_memory 1@ size 1 value 28@ virtual_protect 1
1@ += 1 // move to next address
end
end
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination
0AB2: ret 0
that is what i managed to do
but the problem is the command "/+" is not registered.. the script runs everytime textdraw 2246 appears
i want to execute the script only when the command "/+" is typed.. i tried a lot of version and none of them works
if i put 31@ == TRUE in IF AND then this function 0B4B: samp set_current_dialog_editbox_text 1@ is not working anymore
i dont know what is wrong.. i am not good at cleo, just little stuff
that beats me
 
Status
Not open for further replies.
Top