CLEO Help [HELP] Get command params

CLEO related
Status
Not open for further replies.

Hatake

New member
Joined
Jun 26, 2016
Messages
4
Reaction score
0
I have this code:
Code:
SAMP.IsCommandTyped(0@ 1@)
0AF9: "/f Some text followed by command params Y: %s and Y: %s." 0@ 1@
0B43: samp cmd_ret

I want to send to chat a command like: "/start FIRST_PARAM SECOND_PARAM" and show me the text:
Code:
Some text followed by command params Y: FIRST_PARAM and Y: SECOND_PARAM.

But with SAMP.IsCommandTyped I can't get both params in separated variables. I got both params in 0@ separated with "sapce", how can i get first param in 0@ and the second one in 1@?
 

4changesLeft

Well-known member
Joined
Apr 10, 2015
Messages
365
Reaction score
4
SAMP.IsCommandTyped(1@)
then you use
0AD4: 4@ = scan_string 1@ format "%s %s" 5@v 6@v
and then
0AF9: "/f Some text followed by command params Y: %s and Y: %s." 5@v 6@v
 

Hatake

New member
Joined
Jun 26, 2016
Messages
4
Reaction score
0
Thanks. Now, how can i get params number, it may vary between 1 and 4, and then I want to show a text like this: "Y: FIRST_PARAM Y: SECOND_PARAM Y: THIRD_PARAM" and so on.
 

4changesLeft

Well-known member
Joined
Apr 10, 2015
Messages
365
Reaction score
4
Like the order you put them on 0AD4: 4@ = scan_string 1@ format "%s %s %s" 5@v 6@v 7v
So it has to be like "Y: %s Y: %s Y: %s" 5@v 6@v 7@v
so 5@ = 1st Y
6@ = 2nd Y and so on
 

Hatake

New member
Joined
Jun 26, 2016
Messages
4
Reaction score
0
I already understood that. What I mean, is that I don't want to make 4 commands, I want to make 1, and the parameters may varry. If I have 3 params, then it'll show up 3 Y: PARAM, if I have 2, then just 2 Y: PARAM and so on.
 

Hatake

New member
Joined
Jun 26, 2016
Messages
4
Reaction score
0
How is the new style?

Opcode, I got a problem: I have for example: "/start 123-2332 344-3222" and it stores me in 2@v: 123-344-3222 and in 3@v: 344-3222. Can u tell me what's the problem? I mention that I used %s, not %d
 
Status
Not open for further replies.
Top