CLEO Help Auto answer to friend request

CLEO related

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
Code:
{$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

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 "(%d) sent you a friend request." 4@v
THEN
wait 1000
say "/Accept friend %d" 4@v
wait 1000
END

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

END

what did i wrong? it wont ever work. i tryed many ways but not working looking for hours for something but nothing work lol.

Chatlog : Sebi (88) sent you a friend request. If you want to accept it type /friends accept 88

screenshot from chatlog in Attachments

Also tryed : 0AD4: $NOT_USED = scan_string 0@ format "Player %d sent you a friend request. If you want to accept it type /friends accept %d" 4@v

not working.. can anyone help?
 

Attachments

  • 1631734568068.png
    1631734568068.png
    11 KB · Views: 30
Last edited:

Juli4n

Active member
Joined
Mar 31, 2021
Messages
43
Solutions
1
Reaction score
19
Location
Argentina
not tested
Code:
{$CLEO .cs}

0000:

while 8AFA:
    wait 0
end

0AC8: 0@ = allocate_memory_size 260

while true
    wait 0
    if
    0B61:  samp is_local_player_spawned
    then
        0B75: samp get_chat_string 99 text_to 0@ prefix_to $NOT_USED color_to $NOT_USED prefix_color_to $NOT_USED
        if
        0C29: 1@ = stristr string1 0@ string2 "/friends accept"
        then
            0C11: memset destination 0@ value 0 size 260
            wait 1000
            0AF9: samp say_msg 1@
            wait 1000
        end
    end
end
 

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
not tested
Code:
{$CLEO .cs}

0000:

while 8AFA:
    wait 0
end

0AC8: 0@ = allocate_memory_size 260

while true
    wait 0
    if
    0B61:  samp is_local_player_spawned
    then
        0B75: samp get_chat_string 99 text_to 0@ prefix_to $NOT_USED color_to $NOT_USED prefix_color_to $NOT_USED
        if
        0C29: 1@ = stristr string1 0@ string2 "/friends accept"
        then
            0C11: memset destination 0@ value 0 size 260
            wait 1000
            0AF9: samp say_msg 1@
            wait 1000
        end
    end
end

Syntax: /id <name or id>

not working, but ty fot trying
 

Krc

Active member
Joined
Mar 30, 2018
Messages
193
Reaction score
25
Location
Lithuania
Code:
If
0AD4: $NOT_USED = scan_string 0@ format "%s (%d) sent you a friend request. %s" 4@v  5@ $NOT_USED
Then
say "/accept %d" 5@
end
 

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
I found an issue with ChatID from sampfuncts, when i delete the chat id the mod works fine but when i put the chatid.sf inside sanybuilder folder this happends:


it will find some players like this : nickname[id] and some players like this : nickname (id)

and it will work only on players that have : nickname(id)

its there anyway to fix that?

here is my code :

Code:
{$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

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 (%d)  's phone number %s" 4@v 5@ $NOT_USED
Then
0AF8: samp add_message_to_chat "{0FD81F}id detected : %d gg" 5@
end                                                                                     

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

END

@Juli4n @kazkaS @Parazitas @ajom
 

Attachments

  • 1631794390984.png
    1631794390984.png
    24.6 KB · Views: 41

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
how can i use this : "Player %s (%d) has been seen driving the vehicle" as replace for %s (%d) 's phone number %s

i used this but not working :

0AD4: $NOT_USED = scan_string 1@ format "%s Player %s (%d) has been seen driving the vehicle %s" $NOT_USED 4@v 5@ $NOT_USED

Chatlog > (Radar): {FFFFFF}Player Mert (6) has been seen driving the vehicle Infernus (model:411) with speed 226 km/h.

now i only need this : Player Mert (6) Has been seen driving the vehicle

the other things should not be detected i dont need them.. and its a random values so its to hard

if u can make detect it..

my code untill now :

Code:
[CODE]{$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



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 1@ format "%s Player %s (%d) has been seen driving the vehicle %s" $NOT_USED 4@v 5@ $NOT_USED

Then

0AF8: samp add_message_to_chat "{0FD81F}DEBUG: player id: %d, using command /mdc" 5@
wait 1000
0AF9: samp say_msg "/mdc %d" 5@
wait 500

end                                                                                 



0AC9: free_allocated_memory 0@

0AC9: free_allocated_memory 1@
 

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
And nop it's not the same. I'm using that /number command so I can test the script if it works or not.. It's different it needs to detect this :
If

0AD4: $NOT_USED = scan_string 1@ format "%s Player %s (%d) has been seen driving the vehicle %s" $NOT_USED 4@v 5@ $NOT_USED

Then

0AF8: samp add_message_to_chat "{0FD81F}DEBUG: player id: %d, using command /mdc" 5@
wait 1000
0AF9: samp say_msg "/mdc %d" 5@

itf for detecting when a player comes to radar and then type /mdc that player
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
Opcode 0AD4 seems to can't properly handle %s. Try using sscanf instead:

PHP:
0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
If 0@ > 0 // a chat message was found
Then
    Alloc 1@ 30 // increase size if needed
    Alloc 2@ 30 // increase size if needed
    0AC7: 3@ = var 3@ offset // must be a pointer to itself because pointer is expected by sscanf (doesn't need memory allocation because it will hold an integer)
    Alloc 4@ 30 // increase size if needed
    0AA7: _sscanf 0x8220AD params 6 pop 6 _ptr4 4@ _ptr3 3@ _ptr2 2@ _ptr1 1@ _format "%s Player %s (%d) has been seen driving the vehicle %s" _OfString 0@ _returndetectedcount 5@ // all parameters of 0x8220AD needs to be a pointer , 0@ holds the pointer of the message
    If 5@ == 4 // all 4 formatting are detected
    Then printf "%s~n~%s~n~%d~n~%s" 1@ 2@ 3@ 4@
    End
    Free 1@
    Free 2@
    Free 4@
End

Related references to function 0x8220AD:
sscanf tutorial
sscanf cleo help
 

Derrekgamer

Active member
Joined
Oct 26, 2020
Messages
93
Reaction score
1
Location
Grecee
Opcode 0AD4 seems to can't properly handle %s. Try using sscanf instead:

PHP:
0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to 2@ prefix_color_to 3@
If 0@ > 0 // a chat message was found
Then
    Alloc 1@ 30 // increase size if needed
    Alloc 2@ 30 // increase size if needed
    0AC7: 3@ = var 3@ offset // must be a pointer to itself because pointer is expected by sscanf (doesn't need memory allocation because it will hold an integer)
    Alloc 4@ 30 // increase size if needed
    0AA7: _sscanf 0x8220AD params 6 pop 6 _ptr4 4@ _ptr3 3@ _ptr2 2@ _ptr1 1@ _format "%s Player %s (%d) has been seen driving the vehicle %s" _OfString 0@ _returndetectedcount 5@ // all parameters of 0x8220AD needs to be a pointer , 0@ holds the pointer of the message
    If 5@ == 4 // all 4 formatting are detected
    Then printf "%s~n~%s~n~%d~n~%s" 1@ 2@ 3@ 4@
    End
    Free 1@
    Free 2@
    Free 4@
End

Related references to function 0x8220AD:
sscanf tutorial
sscanf cleo help

Fixed it thank you so much for your help dude, you help me a loot, topic can be closed.
 
Top