CLEO Help Scan string problem

CLEO related
Status
Not open for further replies.

Ravenous

Active member
Joined
Jan 21, 2016
Messages
61
Reaction score
4
Can someone tell my this isn't working?

Code:
{$CLEO}
0000: NOP
repeat
wait 50
until 0AFA: is_samp_structures_available



0B34: samp register_client_command "chl" to_label @activated_76764
0B34: samp register_client_command "test" to_label @activated_76765
   

While true
wait 0
0ac8: 1@ = 260
SAMP.GetChatString(99, 1@, 2@, 3@, 4@)
0AD4: 28@ = scan_string 1@ format "Name: {CECECE}%s{FFFFFF} | Number: {CECECE}%d" 8@v 6@
free 1@
end
                    


:activated_76764
chatmsg "chatline: %s" -1 1@
samp.CmdRet

:activated_76765
chatmsg "number: %d" -1 6@
chatmsg "name: %s" -1 8@v
samp.CmdRet

when i do /test i get something like this:
number: 0
name: Ravenous

So the number doesn't get stored i don't know why.

Here is an actual chatline: 
Name: {CECECE}Ravenous{FFFFFF} | Number: {CECECE}6969
 

Ravenous

Active member
Joined
Jan 21, 2016
Messages
61
Reaction score
4
This is the chatline
Name: {CECECE}Ravenous{FFFFFF} | Number: {CECECE}6969

if i do
0AD4: 28@ = scan_string 1@ format "Name: {CECECE}Ravenous{FFFFFF} | Number: {CECECE}%d" 6@
then 6@ gets the value 6969

if i do
0AD4: 28@ = scan_string 1@ format "Name: {CECECE}%s{FFFFFF} | Number: {CECECE}%d" 8@v 6@
then nothing happens to 6@ it shows me the value 0

why is this? i need to store the numbers of different people on the server so the name won't always be ravenous.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
if everything seems right but is not working you could "go paranoid" and check the same code using variable 30@ instead of 6@, probably won't help but that's what I'd do;p
 

Mennims

Active member
Joined
Mar 18, 2014
Messages
41
Reaction score
0
What are you trying to do in the script?


I tested your script and simulated the chat the server would send, and got the same issue as you. What server is this and how do I get the server to output this text? The problem seems to lie with the colour codes. If i were to remove the colour codes entirely, from both the scan_string and and the add_message_to_chat opcode, it works perfectly. From what I've found out the scan_string needs to have the correct colour codes and in the exact format as the server output, then it should work.
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
Seems right, maybe you're using wrong color codes. You should also use that opcode as a condition, it returns the number of results.
 
Status
Not open for further replies.
Top