CLEO Help Chat reader

CLEO related
Status
Not open for further replies.

attic

Active member
Joined
Jan 13, 2017
Messages
40
Reaction score
0
Okay so this is section of CLEO i never touched and I need advice which path to take,I want to read string and respond if its "*name* blabla" but i want to run it always *name* is not imprtant

is ahk log reading a good idea or should i go with cleo and what opcodes should i look for that
 

PlasticBottle

Active member
Joined
Jul 13, 2016
Messages
162
Reaction score
1
Cleo is simpler I think, use 0AD4 to scan a string, then strcmp (not sure, I don't have the opcodes right now) to compare with a string then do your stuff

Here's a topic about it, you're gonna have to look a bit : http://ugbase.eu/Thread-How-do-I-compare-two-strings-easily-to-see-if-they-re-equal
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
51
Location
LongForgotten <-> 0x32789
you will have to scan strings but you will need to make it for each server you want to use the cleo in or want to play on because every server has different formats of messages like in RP servers you will have to scan "%s says: %s"
 

attic

Active member
Joined
Jan 13, 2017
Messages
40
Reaction score
0
0x32789 said:
you will have to scan strings but you will need to make it for each server you want to use the cleo in or want to play on because every server has different formats of messages like in RP servers you will have to scan "%s says: %s"

shouldi use snippet for getting last command or is there anything easier?and how would my scantstring look like

i was trying something but it only crashed me
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,117
Solutions
5
Reaction score
882
Location
Lithuania
attic said:
0x32789 said:
you will have to scan strings but you will need to make it for each server you want to use the cleo in or want to play on because every server has different formats of messages like in RP servers you will have to scan "%s says: %s"

shouldi use snippet for getting last command or is there anything easier?and how would my scantstring look like

i was trying something but it only crashed me

Here is very many info.:
http://ugbase.eu/Thread-Help-with-cleo--16507
 

attic

Active member
Joined
Jan 13, 2017
Messages
40
Reaction score
0
Code:
{$CLEO}
0000:
wait 5000

:MAIN

REPEAT
   wait 0
UNTIL SAMP.Available

while true
   wait 5000
   0AC8:   1@ = allocate_memory_size 145
   0AB1:   call @getChatEntryText 1 id 99 to 1@
   if
        0AD4: $NOT_USED = scan_string 0@ format "* Bodyguard %s wants to protect you for $200, type /accept bodyguard to accept." $NOT_USED
   jf @MAIN
   jump @ACCEPT
     

:ACCEPT
wait 0
0AF9: samp say_msg "/accept bodyguard"
wait 500
jump @MAIN

:GETCHATENTRYTEXT
IF 0AA2: 1@ = "samp.dll"
THEN
   1@ += 0x21A0E4
   0A8D: 1@ readMem 1@ sz 4 vp 0
   1@ += 0x132
   0@ *= 0xFC
   005A: 1@ += 0@ 
   1@ += 0x20
   0AA3: 1@
END
0AB2: ret 1 1@
makes my gta crash
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
attic said:
Code:
{$CLEO}
0000:
wait 5000

:MAIN

REPEAT
   wait 0
UNTIL SAMP.Available

while true
   wait 5000
   0AC8:   1@ = allocate_memory_size 145
   0AB1:   call @getChatEntryText 1 id 99 to 1@
   if
        0AD4: $NOT_USED = scan_string 0@ format "* Bodyguard %s wants to protect you for $200, type /accept bodyguard to accept." $NOT_USED
   jf @MAIN
   jump @ACCEPT
     

:ACCEPT
wait 0
0AF9: samp say_msg "/accept bodyguard"
wait 500
jump @MAIN

:GETCHATENTRYTEXT
IF 0AA2: 1@ = "samp.dll"
THEN
   1@ += 0x21A0E4
   0A8D: 1@ readMem 1@ sz 4 vp 0
   1@ += 0x132
   0@ *= 0xFC
   005A: 1@ += 0@ 
   1@ += 0x20
   0AA3: 1@
END
0AB2: ret 1 1@
makes my gta crash


Incorrect usage of 0AD4 opcode? You get the text from :GETCHATENTRYTEXT snippet to the 1@ and...? No comparing? This is the problem
Plus the syntax is pretty bad tho, is this :GETCHATENTRYTEXT supposed to get you a desired line from chat? If I got it right, you better use 0B75: samp get_chat_string 99 text_to 1@ prefix_to 2@ color_to 3@ prefix_color_to 4@, guess you can null unused parameters here
 

attic

Active member
Joined
Jan 13, 2017
Messages
40
Reaction score
0
supahdupahnubah said:
attic said:
Code:
{$CLEO}
0000:
wait 5000

:MAIN

REPEAT
   wait 0
UNTIL SAMP.Available

while true
   wait 5000
   0AC8:   1@ = allocate_memory_size 145
   0AB1:   call @getChatEntryText 1 id 99 to 1@
   if
        0AD4: $NOT_USED = scan_string 0@ format "* Bodyguard %s wants to protect you for $200, type /accept bodyguard to accept." $NOT_USED
   jf @MAIN
   jump @ACCEPT
     

:ACCEPT
wait 0
0AF9: samp say_msg "/accept bodyguard"
wait 500
jump @MAIN

:GETCHATENTRYTEXT
IF 0AA2: 1@ = "samp.dll"
THEN
   1@ += 0x21A0E4
   0A8D: 1@ readMem 1@ sz 4 vp 0
   1@ += 0x132
   0@ *= 0xFC
   005A: 1@ += 0@ 
   1@ += 0x20
   0AA3: 1@
END
0AB2: ret 1 1@
makes my gta crash


Incorrect usage of 0AD4 opcode? You get the text from :GETCHATENTRYTEXT snipper to the 1@ and...? No comparing? This is the problem
Plus the syntax is pretty bad tho, is this :GETCHATENTRYTEXT supposed to get you a desired line from chat? If I got it right, you better use 0B75: samp get_chat_string 99 text_to 1@ prefix_to 2@ color_to 3@ prefix_color_to 4@, guess you can null unused parameters here

i think i got it,the snippet is from the thread someone provided up
 
Status
Not open for further replies.
Top