CLEO Help [HELP] 1 command activate other command

CLEO related
Status
Not open for further replies.

kakaka

Active member
Joined
Jun 7, 2014
Messages
59
Reaction score
0
Hello guys,i need a cleo,when 1 type my command,he execute other,but with variables.

Example : When i type /s 3 5 7 9                            [numbers is id of the player]
he take each number and add the command

Code:
      {$CLEO .cs}

0000: NOP
 
if 0@ = SAMP.Base()
then
    while not SAMP.Available()
        wait 500
        end
    0B34: samp register_client_command "s" to_label @varma
    else end_thread
end

while true
    wait 0
end

:varma
0B35: samp 0@ = get_last_command_params
0C17: 1@ = strlen 0@
if not 1@ == 0
then
    0ab1: @get_playerid_by_name 1 0@ 1@                                  
    0B36: samp 3@ = get_player_nickname 1@
    0AF8: samp say_msg "/sellweapons %d eagle" 1@
else 0AF8: samp add_message_to_chat "invalid" color 0xFF6347
end
0B43: samp cmd_ret

:get_playerid_by_name
for 1@ = 0 to 1000
    if SAMP.IsPlayerConnected(1@)
    then
        2@ = SAMP.GetPlayerNickname(1@)
        if 0C14: strcmp string1 0@ string2 2@
        then break
        end
    end
end
0ab2: 1 1@

when i type /s [ID1] [ID2] [ID3] [ID4]
He execute the commands :

/sellweapons ID1 EAGLE
/sellweapons ID2 eagle
/sellweapons ID3 eagle
/sellweapons ID4 eagle

How to make it
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
You want to do this?

If I type /s id id id id, execute other command? That is what you want? The id must be between 0 and 1000.

Here is the code i think this is what you want: (maybe you must add other condition to SAMP.IsPlayerConnected(5@) i'm not sure)

Code:
{$CLEO .cs}

0000: NOP

0B34: samp register_client_command "s" to_label @varma

:loop
wait 0
jump @loop

:varma
SAMP.IsCommandTyped(3@)
if
0AD4: 4@ = scan_string 3@ format "%d %d %d %d" 5@ 6@ 7@ 8@ //IF and SET
else_jump @varmaerror
if 
   SAMP.IsPlayerConnected(5@)
else_jump @varmanotconn   
0AF9: "/sellweapons %d eagle" 5@
0AF9: "/sellweapons %d eagle" 6@
0AF9: "/sellweapons %d eagle" 7@
0AF9: "/sellweapons %d eagle" 8@
jump @varmaret

:varmaerror
wait 0
0AF8: samp add_message_to_chat "USAGE: /s <ID> <ID> <ID> <ID>" color 12566463
SAMP.CmdRet  

:varmanotconn
wait 0
0AF8: samp add_message_to_chat "PLAYER IS NOT CONNECTED!" color 12566463
SAMP.CmdRet  

:varmaret
SAMP.CmdRet 
 

kakaka

Active member
Joined
Jun 7, 2014
Messages
59
Reaction score
0
pepeelpubero link said:
You want to do this?

If I type /s id id id id, execute other command? That is what you want? The id must be between 0 and 1000.

Here is the code i think this is what you want: (maybe you must add other condition to SAMP.IsPlayerConnected(5@) i'm not sure)

Code:
{$CLEO .cs}

0000: NOP

0B34: samp register_client_command "s" to_label @varma

:loop
wait 0
jump @loop

:varma
SAMP.IsCommandTyped(3@)
if
0AD4: 4@ = scan_string 3@ format "%d %d %d %d" 5@ 6@ 7@ 8@ //IF and SET
else_jump @varmaerror
if 
   SAMP.IsPlayerConnected(5@)
else_jump @varmanotconn   
0AF9: "/sellweapons %d eagle" 5@
0AF9: "/sellweapons %d eagle" 6@
0AF9: "/sellweapons %d eagle" 7@
0AF9: "/sellweapons %d eagle" 8@
jump @varmaret

:varmaerror
wait 0
0AF8: samp add_message_to_chat "USAGE: /s <ID> <ID> <ID> <ID>" color 12566463
SAMP.CmdRet  

:varmanotconn
wait 0
0AF8: samp add_message_to_chat "PLAYER IS NOT CONNECTED!" color 12566463
SAMP.CmdRet  

:varmaret
SAMP.CmdRet 

Hello,thanks,yes,it is,but is not runing.
When i type the command,he say :

player 65535 not online
player 65535 not online
player 65535 not online
player 65535 not online

And players is online,but he say this,Why?

he type : /sellweapons D eagle
 

pepeelpubero

Well-known member
Joined
Jan 21, 2014
Messages
433
Reaction score
1
Working for me (tested 2 min ago), try doing this:

PRESS F10 > Formats tab > Case converting > As is > OK > Compile and try again.

And compile this code i made a fix:

Code:
{$CLEO .cs}

0000: NOP

0B34: samp register_client_command "s" to_label @varma

:loop
wait 0
jump @loop

:varma
SAMP.IsCommandTyped(3@)
if
0AD4: 4@ = scan_string 3@ format "%d %d %d %d" 5@ 6@ 7@ 8@ //IF and SET
else_jump @varmaerror
if 
   SAMP.IsPlayerConnected(5@)
else_jump @varmanotconnid1 
if   
   SAMP.IsPlayerConnected(6@)
else_jump @varmanotconnid2
if 
   SAMP.IsPlayerConnected(7@)
else_jump @varmanotconnid3
if 
   SAMP.IsPlayerConnected(8@)
else_jump @varmanotconnid4   
0AF9: "sellweapons %d eagle" 5@
0AF9: "sellweapons %d eagle" 6@
0AF9: "sellweapons %d eagle" 7@
0AF9: "sellweapons %d eagle" 8@
jump @varmaret

:varmaerror
wait 0
0AF8: samp add_message_to_chat "USAGE: /s <ID> <ID> <ID> <ID>" color 12566463
SAMP.CmdRet  

:varmanotconnid1
wait 0
0AF8: samp add_message_to_chat "ID %d IS NOT CONNECTED!" color 12566463 5@
SAMP.CmdRet

:varmanotconnid2
wait 0
0AF8: samp add_message_to_chat "ID %d IS NOT CONNECTED!" color 12566463 6@
SAMP.CmdRet 

:varmanotconnid3
wait 0
0AF8: samp add_message_to_chat "ID %d IS NOT CONNECTED!" color 12566463 7@
SAMP.CmdRet

:varmanotconnid4
wait 0
0AF8: samp add_message_to_chat "ID %d IS NOT CONNECTED!" color 12566463 8@
SAMP.CmdRet     

:varmaret
SAMP.CmdRet
 

kakaka

Active member
Joined
Jun 7, 2014
Messages
59
Reaction score
0
pepeelpubero link said:
Working for me (tested 2 min ago), try doing this:

PRESS F10 > Formats tab > Case converting > As is > OK > Compile and try again.

And compile this code i made a fix:

Code:
{$CLEO .cs}

0000: NOP

0B34: samp register_client_command "s" to_label @varma

:loop
wait 0
jump @loop

:varma
SAMP.IsCommandTyped(3@)
if
0AD4: 4@ = scan_string 3@ format "%d %d %d %d" 5@ 6@ 7@ 8@ //IF and SET
else_jump @varmaerror
if 
   SAMP.IsPlayerConnected(5@)
else_jump @varmanotconnid1 
if   
   SAMP.IsPlayerConnected(6@)
else_jump @varmanotconnid2
if 
   SAMP.IsPlayerConnected(7@)
else_jump @varmanotconnid3
if 
   SAMP.IsPlayerConnected(8@)
else_jump @varmanotconnid4   
0AF9: "sellweapons %d eagle" 5@
0AF9: "sellweapons %d eagle" 6@
0AF9: "sellweapons %d eagle" 7@
0AF9: "sellweapons %d eagle" 8@
jump @varmaret

:varmaerror
wait 0
0AF8: samp add_message_to_chat "USAGE: /s <ID> <ID> <ID> <ID>" color 12566463
SAMP.CmdRet  

:varmanotconnid1
wait 0
0AF8: samp add_message_to_chat "ID %d IS NOT CONNECTED!" color 12566463 5@
SAMP.CmdRet

:varmanotconnid2
wait 0
0AF8: samp add_message_to_chat "ID %d IS NOT CONNECTED!" color 12566463 6@
SAMP.CmdRet 

:varmanotconnid3
wait 0
0AF8: samp add_message_to_chat "ID %d IS NOT CONNECTED!" color 12566463 7@
SAMP.CmdRet

:varmanotconnid4
wait 0
0AF8: samp add_message_to_chat "ID %d IS NOT CONNECTED!" color 12566463 8@
SAMP.CmdRet     

:varmaret
SAMP.CmdRet

Thank you =D S2
 
Status
Not open for further replies.
Top