CLEO Help Help script blackjack

CLEO related
Status
Not open for further replies.

davidel

Well-known member
Joined
Jan 17, 2020
Messages
207
Reaction score
7
Location
Germania
Can anyone help me? The whole blackjack system is based on textdraw. I made a cleo which runs the system automatically, but not how i really want. The only thing i can’t make it is that:

you have on the right side PLAYER: 14. (14 is the value of cards)
I want when the value is <= 16 to execute send click textdraw and "/bjhit" until reach 16 or more. And if the value reach 16 or higher, i want to execute "/bjstand"
this is tomething i tried but it s not working

Code:
{$CLEO .cs}

0000: NOP

REPEAT
WAIT 0
UNTIL 0AFA:


WHILE TRUE
WAIT 0
    IF
        0C5D: samp textdraw 2091 is_exists
THEN
ALLOC 1@ = 1024
0C5A: samp textdraw 2091 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@
IF 2@ <= 16
then
wait 100
0BCA: samp send_click_textdraw 14
wait 100
0c8f: samp process_chat_input "/bjhit"
else
0c8f: samp process_chat_input "/bjstand"
END
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
 
Status
Not open for further replies.
Top