CLEO Help help dialogs

CLEO related
Status
Not open for further replies.

Zin

Expert
Joined
Aug 1, 2013
Messages
1,697
Reaction score
105
Just make a sort of dynamic activation var. Basically you add this var to the condition of each "IF-THEN-END" statement and you have each "IF-THEN-END" statement be triggered by a different value of this var.
C++:
{$CLEO .cs}

THREAD 'Order, ORDER!"

REPEAT
    WAIT 0
UNTIL 0AFA:

// 0@ = 0 ~ vars are default 0 at start of script.
// 0@ is the activation var.

WHILE TRUE
    WAIT 0
    
    // 0
    IF AND
        0@ == 0
        0C5D: samp textdraw 1337 is_exists
    THEN
        // DO STUFF
        0@ = 1 // Will allow "1" to trigger.
    END
    
    // 1
    IF AND
        0@ == 1
        0C5D: samp textdraw 1338 is_exists
    THEN
        // DO STUFF
        0@ = 2 // Will allow "2" to trigger.
    END
    
    // 2
    IF AND
        0@ == 2
        0C5D: samp textdraw 1339 is_exists
    THEN
        // DO STUFF
        0@ = 0 // Will allow "0" to trigger.
    END
    
    
END
 

davidel

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

THREAD "Order, ORDER!"

REPEAT
    WAIT 0
UNTIL 0AFA:

// 0@ = 0 ~ vars are default 0 at start of script.
// 0@ is the activation var.

WHILE TRUE
    WAIT 0
    
    // 0
    IF AND
        0@ == 0
        0C5D: samp textdraw 2262 is_exists
THEN
ALLOC 1@ = 1024
0C5A: samp textdraw 2262 get_string_to 1@
0AC8: 2@ = allocate_memory_size 260
0AB1: @get_digits_to_print param_count 2 text 1@ memory_to_store_digits_as_text 2@
0B49: samp set_current_dialog_list_item 0
0B4B: samp set_current_dialog_editbox_text 2@
0B47: samp close_current_dialog_with_button 1
FREE 1@
        0@ = 1 // Will allow "1" to trigger.
    END
    
    // 1
    IF AND
        0@ == 1
        0C5D: samp textdraw 2263 is_exists
THEN
ALLOC 3@ = 1024
0C5A: samp textdraw 2263 get_string_to 3@
0AC8: 4@ = allocate_memory_size 260
0AB1: @get_digits_to_print param_count 2 text 3@ memory_to_store_digits_as_text 4@
0B49: samp set_current_dialog_list_item 1
0B4B: samp set_current_dialog_editbox_text 4@
0B47: samp close_current_dialog_with_button 1
FREE 3@        
        0@ = 2 // Will allow "2" to trigger.
    END
    
    // 2
    IF AND
        0@ == 2
        0C5D: samp textdraw 2264 is_exists
THEN
ALLOC 5@ = 1024
0C5A: samp textdraw 2264 get_string_to 5@
0AC8: 6@ = allocate_memory_size 260
0AB1: @get_digits_to_print param_count 2 text 5@ memory_to_store_digits_as_text 6@
0B49: samp set_current_dialog_list_item 2
0B4B: samp set_current_dialog_editbox_text 6@
0B47: samp close_current_dialog_with_button 1
FREE 5@
        0@ = 0 // Will allow "0" to trigger.
    END

END 
: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
it get stuck at textdraw 2262 and keep buying redkits (for textdraw 2262 is buying redkits)
it doesnt move to textdraw 2263
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,697
Reaction score
105
Code:
{$CLEO .cs}

THREAD "Order, ORDER!"

REPEAT
    WAIT 0
UNTIL 0AFA:

// 0@ = 0 ~ vars are default 0 at start of script.
// 0@ is the activation var.

WHILE TRUE
    WAIT 0
   
    // 0
    IF AND
        0@ == 0
        0C5D: samp textdraw 2262 is_exists
THEN
ALLOC 1@ = 1024
0C5A: samp textdraw 2262 get_string_to 1@
0AC8: 2@ = allocate_memory_size 260
0AB1: @get_digits_to_print param_count 2 text 1@ memory_to_store_digits_as_text 2@
0B49: samp set_current_dialog_list_item 0
0B4B: samp set_current_dialog_editbox_text 2@
0B47: samp close_current_dialog_with_button 1
FREE 1@
        0@ = 1 // Will allow "1" to trigger.
    END
   
    // 1
    IF AND
        0@ == 1
        0C5D: samp textdraw 2263 is_exists
THEN
ALLOC 3@ = 1024
0C5A: samp textdraw 2263 get_string_to 3@
0AC8: 4@ = allocate_memory_size 260
0AB1: @get_digits_to_print param_count 2 text 3@ memory_to_store_digits_as_text 4@
0B49: samp set_current_dialog_list_item 1
0B4B: samp set_current_dialog_editbox_text 4@
0B47: samp close_current_dialog_with_button 1
FREE 3@       
        0@ = 2 // Will allow "2" to trigger.
    END
   
    // 2
    IF AND
        0@ == 2
        0C5D: samp textdraw 2264 is_exists
THEN
ALLOC 5@ = 1024
0C5A: samp textdraw 2264 get_string_to 5@
0AC8: 6@ = allocate_memory_size 260
0AB1: @get_digits_to_print param_count 2 text 5@ memory_to_store_digits_as_text 6@
0B49: samp set_current_dialog_list_item 2
0B4B: samp set_current_dialog_editbox_text 6@
0B47: samp close_current_dialog_with_button 1
FREE 5@
        0@ = 0 // Will allow "0" to trigger.
    END

END
: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
it get stuck at textdraw 2262 and keep buying redkits (for textdraw 2262 is buying redkits)
it doesnt move to textdraw 2263
Well there's something up with your textdraws then.
 
Status
Not open for further replies.
Top