CLEO Help auto accept

CLEO related
Status
Not open for further replies.

davidel

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

REPEAT
WAIT 0
UNTIL 0AFA: SAMP_IS_READY

WHILE TRUE
WAIT 0

0AC8: 0@ = allocate_memory_size 260
0AC8: 1@ = allocate_memory_size 260
0AC8: 5@ = allocate_memory_size 260

0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@

IF
0AD4: $NOT_USED = scan_string 0@ format "%s te-a invitat sa joci barbut cu el pe 10,000,000$. Scrie /acceptdice %d pentru a juca." $NOT_USED 4@v
THEN
wait 1000
format 5@ "/acceptdice %s" 4@v
say 5@
wait 1000
END

0AC9: free_allocated_memory 0@
0AC9: free_allocated_memory 1@
0AC9: free_allocated_memory 5@

END

when someone send me an offer, it sends /acceptdice command but i dont know how it sends because it says "The player doesn't send you an offer." what is the problem?..
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
Do you have to /acceptdice their name or ID? Some of the string formatting doesn't make much sense either. You can use "LOG 5@" to send the output to your sampfuncs log also to see what is actually happening.
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
{$CLEO .cs}  

0000:

REPEAT
WAIT 0
UNTIL 0AFA: SAMP_IS_READY

WHILE TRUE
WAIT 0

IF
0B61:  samp is_local_player_spawned
THEN
    0AC8: 0@ = allocate_memory_size 260
    0AC8: 1@ = allocate_memory_size 260
    0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
    IF
    0C29: $NOT_USED = stristr string1 0@ string2 "has sent you a dice request"
    THEN
        0AB1: @GetTextAfterSlash 1 StringPointer 0@ _Return 4@
        0AB1: @CollectAllDigits 1 stringPointer 4@// SELF RETURN
        SAY "/acceptdice %s" 4@
    END
END    

END

:GetTextAfterSlash
{
    0AB1: @GetTextAfterSlash 1 StringPointer 5@ _Return 6@
}
0C17: 31@ = strlen 0@
31@ -= 1
for 30@ = 0 to 31@
0A8D: 29@ = read_memory 0@ size 1 virtual_protect 1 
    if 
    29@ == 47 // 47 - /
    then
        0@++
        0AB2: 1 0@                                                     
    end    
0@++
end
0AB2: 0

:CollectAllDigits
{
    0AB1: @CollectAllDigits 1 stringPointer 1@
    Self Return: 1@ - Digits
}
0C17: 31@ = strlen 0@
31@ -= 1
0085: 28@ = 0@
005A: 28@ += 31@
0085: 27@ = 0@
for 30@ = 0@ to 28@
0A8D: 29@ = read_memory 30@ size 1 virtual_protect 1
    if and // if is equal or higher than "0" in ascii, and if is equal or lower than "9" in ascii (http://www.asciitable.com/index/asciifull.gif)
    0029:   29@ >= 48
    002B:   57 >= 29@
    then
        0A8C: write_memory 27@ size 1 value 29@ virtual_protect 1
        27@++ //27@ increases only if it's a digit
    else
        // do nothing...
    end     
end
0A8C: write_memory 27@ size 1 value 0 virtual_protect 1
0AB2: ret 0
 
Last edited:

Zin

Expert
Joined
Aug 1, 2013
Messages
1,719
Solutions
1
Reaction score
111
Bad formatting is the issue here. You used 0AD4 to gather a random string and store it to $NOT_USED and then stored an integer to a string var "4@v" also that's not really used as we have 0AC8 opcode.
Code:
{$CLEO .cs}
0000:

REPEAT
    WAIT 0
UNTIL 0AFA: SAMP_IS_READY

WHILE TRUE
    WAIT 0
    
    alloc 0@ 260 // only need to read one string and this var can be reused.
    
    0B75: samp get_chat_string 99 text_to 0@ prefix_to $NOT_USED color_to $NOT_USED prefix_color_to $NOT_USED
    
    IF
         0AD4: $NOT_USED = scan_string 0@ format "te-a invitat sa joci barbut cu el pe 10,000,000$. Scrie /acceptdice %d pentru a juca." 0@ // store /acceptdice %d to 0@
    THEN
        0AD3: 0@ = format "/acceptdice %d" 0@ // put 0@ into /acceptdice [whatever 0@ is]
        say 0@
        wait 1000
    END
    
    free 0@
    
END
This probably still won't work as you need to put the proper string into 0AD4, get it from chatlog.txt but don't put the prefix in which is usually the name or tag or whatever or the suffix just put the main body of text.
 
Status
Not open for further replies.
Top