CLEO Help Help me please Cleo Mod

CLEO related
Status
Not open for further replies.

JrJunioru

Member
Joined
Apr 7, 2017
Messages
14
Reaction score
0
Hello guys, I'm trying to create a cleo mod like this:
When i'm using the command /mycommand(just an example)
I want it to do : /sms (number) (text) like
/sms 88123 Hello but i want to use:
/mycommand Hello
Explain again? Ok:
When i'm using the command
/mycommand Hello(or another text) to use the command /sms on a number that i wrote in the cs like /sms 88123 and the text: /mycommand What are you doing? (/sms 88123 What are you doing) something like that, i can't explain much more please help me

the code:


:cmd_44
SAMP.IsCommandTyped(20@)
    0AF9: samp say_msg "/sms 88123 %s"
    chatmsg: "> You used the command [/mycommand]"
SAMP.CmdRet()
Help me fast pleasee
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
JrJunioru said:
Hello guys, I'm trying to create a cleo mod like this:
When i'm using the command /mycommand(just an example)
I want it to do : /sms (number) (text) like
/sms 88123 Hello but i want to use:
/mycommand Hello
Explain again? Ok:
When i'm using the command
/mycommand Hello(or another text) to use the command /sms on a number that i wrote in the cs like /sms 88123 and the text: /mycommand What are you doing? (/sms 88123 What are you doing) something like that, i can't explain much more please help me

the code:


:cmd_44
SAMP.IsCommandTyped(20@)
    0AF9: samp say_msg "/sms 88123 %s"
    chatmsg: "> You used the command [/mycommand]"
SAMP.CmdRet()
Help me fast pleasee

You mean like that?.:


[shcode=cpp]
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "mycommand" @Command

WHILE TRUE
    WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if 
0C14: strcmp string1 0@ string2 "%d %s" 1@ 2@
then
say "/sms %d %s" 1@ 2@
0AF8: samp add_message_to_chat "You say: /sms %d %s" color -1  1@ 2@
end

0B43:


////////////////////////////////////////////////////////// Use ////////////////////////////////////////////////////////// 

/mycommand [Your number] [Your text]
[/shcode]
 

JrJunioru

Member
Joined
Apr 7, 2017
Messages
14
Reaction score
0
Thanks you gave me the model, i can now do my command, tnx again! You are the best

Can you do it without number like i don't want to input the number in game i want just to input the text like:
In-Game: I want to write just /mycommand Hello but the script to do /sms 33885 Hello
I am trying to do but i get crashes and errors
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
Try this

[shcode=cpp]
{$CLEO .cs}
0000:
 
 
REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 
 
0B34: "mycommand" @Command
 
WHILE TRUE
    WAIT 0
END
 
:Command
0B35: 0@ = get_last_command_params
0209: 1@ = random_int_in_ranges 2873 3861
if 
0C14: strcmp string1 0@ string2 "%s" 2@
then
say "/sms %d %s" 1@ 2@
0AF8: samp add_message_to_chat "You say: /sms %d %s" color -1  1@ 2@
end
 
0B43:
 
 
////////////////////////////////////////////////////////// Use ////////////////////////////////////////////////////////// 
 
/mycommand [Your number] [Your text]
[/shcode]
 

JrJunioru

Member
Joined
Apr 7, 2017
Messages
14
Reaction score
0
What did you did there is random? I don't want random numbers i want to sms the number that i said

/mycommand text === /sms 33885 text (33885 isn't random, i want this number)
 

JrJunioru

Member
Joined
Apr 7, 2017
Messages
14
Reaction score
0
Parazitas said:
JrJunioru said:
Hello guys, I'm trying to create a cleo mod like this:
When i'm using the command /mycommand(just an example)
I want it to do : /sms (number) (text) like
/sms 88123 Hello but i want to use:
/mycommand Hello
Explain again? Ok:
When i'm using the command
/mycommand Hello(or another text) to use the command /sms on a number that i wrote in the cs like /sms 88123 and the text: /mycommand What are you doing? (/sms 88123 What are you doing) something like that, i can't explain much more please help me

the code:


:cmd_44
SAMP.IsCommandTyped(20@)
    0AF9: samp say_msg "/sms 88123 %s"
    chatmsg: "> You used the command [/mycommand]"
SAMP.CmdRet()
Help me fast pleasee

You mean like that?.:


[shcode=cpp]
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "mycommand" @Command

WHILE TRUE
    WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if 
0C14: strcmp string1 0@ string2 "%d %s" 1@ 2@
then
say "/sms %d %s" 1@ 2@
0AF8: samp add_message_to_chat "You say: /sms %d %s" color -1  1@ 2@
end

0B43:


////////////////////////////////////////////////////////// Use ////////////////////////////////////////////////////////// 

/mycommand [Your number] [Your text]
[/shcode]

Parazitas said:
only this number?
Yea
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
[shcode=cpp]

{$CLEO .cs}
0000:


REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

0B34: "mycommand" @Command

WHILE TRUE
   WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if
0C14: strcmp string1 0@ string2 "%s" 2@
then
say "/sms 88123 %s" 2@
0AF8: samp add_message_to_chat "You say: /sms 88123 %s" color -1 2@
end

0B43:


////////////////////////////////////////////////////////// Use //////////////////////////////////////////////////////////

/mycommand [Your text]

[/shcode]
 

JrJunioru

Member
Joined
Apr 7, 2017
Messages
14
Reaction score
0
Parazitas said:
[shcode=cpp]

{$CLEO .cs}
0000:


REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

0B34: "mycommand" @Command

WHILE TRUE
   WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if
0C14: strcmp string1 0@ string2 "%s" 2@
then
say "/sms 88123 %s" 2@
0AF8: samp add_message_to_chat "You say: /sms 88123 %s" color -1 2@
end

0B43:


////////////////////////////////////////////////////////// Use //////////////////////////////////////////////////////////

/mycommand [Your text]

[/shcode]
Ty, but not working, i just won't try again to make this command.
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
just checked it, added "alloc" + replaced "strcmp" with "scan_string" + replaced 2@ with 0@ because it showed weirds characters with 2@

Code:
{$CLEO .cs}
0000:

REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "mycommand" @Command

alloc 2@ 200
 
WHILE TRUE
   WAIT 0
END
 
:Command
0B35: 0@ = get_last_command_params
if
0AD4: 31@ = scan_string 0@ format "%s" 2@ //IF and SET
then
say "/sms 88123 %s" 0@
0AF8: samp add_message_to_chat "You say: /sms 88123 %s" color -1 0@
end
 
0B43:
 

JrJunioru

Member
Joined
Apr 7, 2017
Messages
14
Reaction score
0
monday said:
just checked it, added "alloc" + replaced "strcmp" with "scan_string" + replaced 2@ with 0@ because it showed weirds characters with 2@

Code:
{$CLEO .cs}
0000:

REPEAT
   WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "mycommand" @Command

alloc 2@ 200
 
WHILE TRUE
   WAIT 0
END
 
:Command
0B35: 0@ = get_last_command_params
if
0AD4: 31@ = scan_string 0@ format "%s" 2@ //IF and SET
then
say "/sms 88123 %s" 0@
0AF8: samp add_message_to_chat "You say: /sms 88123 %s" color -1 0@
end
 
0B43:
Tnx man, but the last question: 0B43: what is doing?
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
[font=arial, sans-serif]And of course[/font][font=arial, sans-serif] [/font][font=arial, sans-serif]you[/font][font=arial, sans-serif] [/font][font=arial, sans-serif]can add a[/font][font=arial, sans-serif] [/font][font=arial, sans-serif]check or[/font][font=arial, sans-serif] [/font][font=arial, sans-serif]properly[/font][font=arial, sans-serif] [/font][font=arial, sans-serif]use[/font][font=arial, sans-serif] [/font][font=arial, sans-serif]this command[/font].

[shcode=cpp]
{$CLEO .cs}
0000:

REPEAT
 WAIT 0
UNTIL 0AFA:  SAMP_IS_READY

0B34: "mycommand" @Command

alloc 2@ 200

WHILE TRUE
 WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if
0AD4: 31@ = scan_string 0@ format "%s" 2@ //IF and SET
then
say "/sms 88123 %s" 0@
0AF8: samp add_message_to_chat "{FF0000}My Command:{FFFFFF} You say: /sms 88123 %s" color -1 0@
end
/////////////////////////////////////// If wrong use this command then... ///////////////////////////////////////
if 0C14: strcmp string1 0@ string2 ""
then
0AF8: "{FF0000}My Command:{FFFFFF} Incorrect use command!" 0xAA5555
0AF8: "{FF0000}My Command:{FFFFFF} Use: {FF0000}/mycommand hi{FFFFFF} or {FF0000}/mycommand bye{FFFFFF} , etc..." 0xAA5555
end

0B43:
[/shcode]
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
@JrJunioru
0b43: is the same as "samp.cmdRet()"


http://ugbase.eu/Thread-Crash-when-execute-custom-command?pid=101425#pid101425
Btw when you use 0B34 opcode it creates a callback at given label. When you enter a command in game by typing "/gun" and press enter the code jumps from the "MAIN" label into the "M4" callback. After it reaches "SAMP.CmdRet" it will jump back where it was before the command was entered

so it "ends" the instructions assigned to the command
 
Status
Not open for further replies.
Top