Jump to content

Timp rămas până la Black Week

Pentru detalii complete despre promoție click aici

Black Week a început!

Pentru detalii complete despre promoție click aici

[CLEO] Use a same comamand to desactive and active


halfastrc
 Share

Recommended Posts

Hello there, I'm a novice, and I'm trying learn a little about CLEO script, and I come here again, to ask for help if possible. 

{$CLEO .cs}

0000: NOP

REPEAT
    WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "weather" to_label @weatheractive

WHILE TRUE
    WAIT 0
END

:weatheractive
    01B6: set_weather 8
    0AF8: samp add_message_to_chat "{32cd32}You're desactive you weather!" -1
    WAIT 1000
SAMP.CmdRet()

:weatherdesactive
    01B7: release_weather
    0AF8: samp add_message_to_chat "{32cd32}You're active you weather!" -1
    WAIT 1000
SAMP.CmdRet()

This a simple script that I made, and I would to know, if is possible, using the same command "/weather" to jump among the two functions ":weatheractive" and ":weatherdesactive".

And if possible explain how can I do, because I would to learn more about this. And thanks so much for the help in the previous scripts ? 

Link to comment
Share on other sites

{$CLEO .cs}

0000: NOP

REPEAT
    WAIT 0
UNTIL 0AFA:

0@ = 0

0B34: samp register_client_command "weather" to_label @weatheractive

WHILE TRUE
    WAIT 0
END

:weatheractive
if 0@ == 0
then
    01B6: set_weather 8
    0AF8: samp add_message_to_chat "{32cd32}Weather ON!" -1
    0@ = 1
else
	01B7: release_weather
    0AF8: samp add_message_to_chat "{32cd32}Weather OFF!" -1
	0@ = 0
end
SAMP.CmdRet()

Simple, take a variable as a boolean, the variable can take only 2 values, 0 or 1. 0 means that the weather is turned off, 1 means that the weather is on and then you do a simple verification with if.

If the weather is OFF (0) then you activate the weather, otherwise (else) you release it.

 

P.S: Wait is working only in repetitive structures (while true, repeat, for)

Edited by Nic
Link to comment
Share on other sites

For example, I want to put ON/OFF in my script that have a "While True"

This the version that I made, but I got some bugs

 

{$CLEO .cs}

0000: NOP

REPEAT
    WAIT 0
UNTIL 0AFA:

0@ = 0

0B34: samp register_client_command "caixinha" to_label @caixinha

:caixinha
IF 0@ == 0
0AF8: samp add_message_to_chat "{32cd32}| INFO |{ffffff} Auto Caixinha ativado com sucesso!" -1 //Enable the script
WAIT 500
WHILE TRUE   
    WAIT 0
    IF
    0B4C:  samp is_dialog_active -1
    THEN  
        0AC8: 0@ = allocate_memory_size 260
        0BD8: samp get_dialog_caption 0@
        IF
        0C29: $NOT_USED = stristr string1 0@ string2 "SALÁRIO" 
        THEN 
            0B47: samp close_current_dialog_with_button 0 
            0AF9: samp say_msg "/caixinha"
            WAIT 5000                                   
        END
        0@ = 1
    ELSE
        0AF8: samp add_message_to_chat "{32cd32}| INFO |{ffffff} Auto Caixinha desativado com sucesso!" -1 // Disable the script
        WAIT 500
        0@ = 0
    END   
END    
SAMP.CmdRet()    

And this, is the original version

{$CLEO .cs}

0000: NOP

REPEAT
    WAIT 0
UNTIL 0AFA:

WHILE TRUE   
    WAIT 0
    IF
    0B4C:  samp is_dialog_active -1
    THEN  
        0AC8: 0@ = allocate_memory_size 260
        0BD8: samp get_dialog_caption 0@
        IF
        0C29: $NOT_USED = stristr string1 0@ string2 "SALÁRIO" 
        THEN 
            0B47: samp close_current_dialog_with_button 0 
            0AF9: samp say_msg "/caixinha"
            WAIT 5000                                   
        END 
    END 
END        

 What I'm doing wrong? 

 

Explaining the script, basicaly when a specific dialog come to the player, the script close the dialog and type a message in chat

Edited by halfastrc
Link to comment
Share on other sites

{$CLEO .cs}

0000: NOP

REPEAT
    WAIT 0
UNTIL 0AFA:

1@ = 0
  
  0B34: samp register_client_command "caixinha" to_label @caixinha


WHILE TRUE   
    WAIT 0
if 1@ == 1  
then

    IF
    0B4C:  samp is_dialog_active -1
    THEN  
        0AC8: 0@ = allocate_memory_size 260
        0BD8: samp get_dialog_caption 0@
        IF
        0C29: $NOT_USED = stristr string1 0@ string2 "SALÁRIO" 
        THEN 
            0B47: samp close_current_dialog_with_button 0 
            0AF9: samp say_msg "/caixinha"
            WAIT 5000                                   
        END 
    END 
end
END     

:caixinha
IF 1@ == 0
then
0AF8: samp add_message_to_chat "{32cd32}| INFO |{ffffff} Auto Caixinha ativado com sucesso!" -1 //Enable the script
1@ = 1
else
0AF8: samp add_message_to_chat "{32cd32}| INFO |{ffffff} OFF!" -1
1@ = 0
end
cmdret

you already have 0@, you can't use it for multiple purposes. 

a command is only declared outside the while true, and you need to type cmdret after the most of the commands:

 

:command

say "ok"

cmdret

 

and u can't have a while true in a command, in a mod only 1 while true can exist which is outside any command.

Link to comment
Share on other sites

sorry for the inconvenience, but I try train this, and I get crash, do u have any tip of what I need learn, to know more about this? I appreciate any tip

{$CLEO .cs}

0000: nop

repeat
    wait 0
until 0afa:

1@ = 0 // what this do and what meaning 1@, it's a var?

0B34: samp register_client_command "msg" to_label @msg

:msg
if 1@ == 0 
then
    0AF8: samp add_message_to_chat "Test one" -1
    wait 500
    1@ = 1
else
    0AF8: samp add_message_to_chat "Test two" -1
    wait 500
    1@ = 0
end 
cmdret    

 

Edited by halfastrc
Link to comment
Share on other sites

@halfastrc It is called a variable that can be used to define terms and conditions. as a normal explanation:

 

- if the user ran the game turn the 1@ variable to 0 number.

- register the "msg" command.

- let's define the @msg command...

- if the 1@ variable were equal with 0 start my codes. otherwise, if the 1@ variable were not equal to 0 starts these specific codes.

 

How is define conditions:

if
1@ == 0
then
    chatmsg "1@ is equal with 0" -1
else
    chatmsg "1@ is not equal with 0" -1
end
if and
1@ == 0
2@ == 2
then
    chatmsg "1@ is equal with 0 and 2@ is equal with 2" -1
else
    chatmsg "one of variable (1@ or 2@) is not equal with their specific value" -1
end
if or
0AB0: 49 //key 1 pressed?
0AB0: 50 //key 2  pressed?
then
    chatmsg "You pressed the 1 or 2 button" -1
end

 

It's impressive you got crashed and IDK how does that happen but I will start from the beginning. try to keep these codes in your mind. (it's the simple base of our Cleo code):

{$CLEO .cs}

0000:
repeat
wait 0
until 0AFA:

0B34: samp register_client_command "test" to_label @1  

if 8AF7: get_samp_base_to 0@
then 
    0A93: end_custom_thread
end
repeat 
    wait 400
until 0AFA: is_samp_structures_available  

WHILE TRUE
WAIT 0

    //some codes

END 
         
:1
chatmsg "Hello World" -1
SAMP.CmdRet()

 

1. I would rather define terms and conditions in our loop (most of the time). because why not but this time is different:

0B34: samp register_client_command "msg" to_label @msg //define the command

 

2. add this code next to your code (to just avoid a crash). i don't really understand SCM but I'm doing it:

:My_Looper
wait 0 
jump @My_Looper

 

3. Define the command

:msg
if 1@ == 0 
then
    chatmsg "Test one." -1
    1@ = 1
cmdret
end    
if 1@ == 1
    then 
    say "Test two."  
    1@ = 0 
end   
cmdret

 

4. compile it and run the code, the whole code shall be like this:

{$CLEO .cs}

0000:
repeat
wait 0
until 0AFA:

0B34: samp register_client_command "msg" to_label @msg 

if 8AF7: get_samp_base_to 0@
then 
    0A93: end_custom_thread
end
repeat 
    wait 400
until 0AFA: is_samp_structures_available  
  
:My_Looper
wait 0 
jump @My_Looper
  
:msg
if 1@ == 0 
then
    chatmsg "Test one." -1
    1@ = 1
cmdret
end    
if 1@ == 1
    then 
    say "Test two." -1
    1@ = 0 
end   
cmdret

 

btw, I didn't test the whole code yet, I just wrote it myself right now, if you got a problem, leave a comment below.

Edited by D J C
Link to comment
Share on other sites

Thanks, I undestand a little better how this working and I made two codes to show if is all alright with them.

{$CLEO .cs}

0000: NOP

REPEAT
    WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "hi" to_label @hello

WHILE TRUE
    WAIT 0
END

:hello
IF 1@ == 0
THEN
    PRINT "Hello there" 3000
    0AF8: samp add_message_to_chat "Test one" -1
    WAIT 500
    IF 1@ = 1
CMDRET
END

IF 1@ == 1
THEN
    PRINT "Thx for the help" 3000
    0AF8: samp add_message_to_chat "Test two" -1
    WAIT 500
    IF 1@ = 0
CMDRET
END

Using else:

{$CLEO .cs}

0000: NOP

REPEAT
    WAIT 0
UNTIL 0AFA:

0B34: samp register_client_command "hi" to_label @hello

WHILE TRUE
    WAIT 0
END

:hello
IF 1@ == 0
THEN
    PRINT "Hello there" 3000
    0AF8: samp add_message_to_chat "Test one" -1
    1@ = 1
    WAIT 500
ELSE
    PRINT "Thx for the help" 3000
    0AF8: samp add_message_to_chat "Test two" -1
    1@ = 0
    WAIT 500
END
CMDRET

Code two:

{$CLEO .cs}

0000: NOP

REPEAT
    WAIT 0
UNTIL 0AFA:

WHILE TRUE
    WAIT 0
IF KEY_DOWN 113 // F2
    THEN
    IF 1@ == 0
        THEN
            PRINT "Hello there" 3000
            0AF8: samp add_message_to_chat "Test one" -1
            1@ = 1
            WAIT 500
        ELSE
            PRINT "Thanks for the help" 3000
            0AF8: samp add_message_to_chat "Test two" -1
            1@ = 0
            WAIT 500
        END
    END
END            

One more question, how can I use output var in CLEO script?

 

For example, I want to show in chat a dialog caption, how can I do it?

 

Edited by halfastrc
Link to comment
Share on other sites

Dialog hex?

{$CLEO .cs}

0000:
repeat
wait 0
until 0AFA:

0B34: samp register_client_command "show" to_label @dialogsex 

if 8AF7: get_samp_base_to 0@
then 
    0A93: end_custom_thread
end
repeat 
    wait 400
until 0AFA: is_samp_structures_available  
  
:My_Looper
wait 0 
jump @My_Looper
  
:dialoghex
if 2@ == 0
then
    0AC6: 3@ = label @dialog_1 offset 
    SAMP.ShowDialog(1000, "Dialog number one", 3@, "Close", "", 0)
    SAMP.CmdRet
    ret 0
end

if 2@ == 1
then
    0AC6: 3@ = label @dialog_2 offset 
    SAMP.ShowDialog(1000, "Dialog number two", 3@, "Close", "", 0)
    SAMP.CmdRet
    ret 0
end

if 2@ == 2
then    
    0AC6: 3@ = label @dialog_3 offset 
    SAMP.ShowDialog(1000, "Dialog number three", 3@, "Close", "", 0)
    SAMP.CmdRet
    ret 0
end
SAMP.CmdRet()

:dialog_1
hex
    "{FFFFFF}Value is 0" A
    "{FFFFFF} " 0
end
ret 0

:dialog_2
hex
    "{FFFFFF}Value is 1" A
    "{FFFFFF} " 0
end
ret 0

:dialog_3
hex
    "{FFFFFF}Value is 2" A
    "{FFFFFF} " 0
end
ret 0

 

Print:

{$CLEO .cs}

0000:
repeat
wait 0
until 0AFA:

0B34: samp register_client_command "msg" to_label @msg 

if 8AF7: get_samp_base_to 0@
then 
    0A93: end_custom_thread
end
repeat 
    wait 400
until 0AFA: is_samp_structures_available  
  
:My_Looper
wait 0 
jump @My_Looper
  
:msg
if 1@ == 0 
then
    0ACD: show_text_highpriority "Test ~r~one" time 1000
    1@ = 1
cmdret
end    
if 1@ == 1
then 
    0ACD: show_text_highpriority "Test ~b~two" time 1000
    1@ = 0 
end   
cmdret

 

If you meant something else, explain to me more because I couldn't understand what exactly you wanted.

Edited by D J C
Link to comment
Share on other sites

Thx for the help

Actually, I'm try learn more about CLEO cause I made somes scripts cools in AHK (AutoHotkey), but I wanna learn more to move them to .cs.

I ask about dialogs cause I wanna do something like this below (to this work it's necessary a SAMP UDF, that leave functions more easy to use)

F2::
        ShowDialog("1", "{0070ba}Approach", "{bdbdbd}Insert ID player!", "Close")
        while (!GetKeyState("Enter", "P") && !GetKeyState("Esc", "P") && !GetKeyState("Close", "P"))
        continue
        if (GetKeyState("Enter", "P") && ("Fechar", "P")){
            sleep 200
            chatInput := readString(hGTA, dwSAMP + 0x12D8F8, 256)
            if (RegExMatch(chatInput, "(\d+)", value)){
                return
                Numpad1::
                    SendInput {F6}/approach %value%{enter}
                    Sleep,100
                    return
                
                Numpad2::
                    SendInput {F6}/handcuff %value%{enter}
                    Sleep,100
                    return
                    
                Numpad3::
                    SendInput {F6}/arrest %value%{enter}
                    Sleep,100
                    return
            }
        }
return

Basically, press F2 open a dialog in the player screen where he's insert a ID in the dialog, and the commands get ready to that ID in Numpad 1, 2 and 3.

 

It's possible do this in .cs?

 

image.png.2c46a5d41af34472f665fd1bb9b0eb32.png

 

I did something like this in .cs but a little diferent. Basically when I type in chat "/locate 12" the commands get ready to this ID in Numpad1, 2 and 3.

{$CLEO .cs}     
              
THREAD 'AUTOID'   

0B34: samp register_client_command "locate" to_label @IDSET   

REPEAT
    WAIT 0
UNTIL 0AFA:

0@ = -1

WHILE TRUE
    WAIT 0
    
    IF
        KEY_DOWN 97 // Numpad1
    THEN
        0AF9: samp say_msg "/approach %d" 0@
        WAIT 2025
    END
    
    IF
        KEY_DOWN 98 // Numpad2
    THEN
        0AF9: samp say_msg "/handcuff %d" 0@
        WAIT 2025
    END
    
    IF
        KEY_DOWN 99 // Numpad3
    THEN
        0AF9: samp say_msg "/arrest %d" 0@
        WAIT 2025
    END     
END

:IDSET
0B35: samp 0@ = get_last_command_params
IF
    0AD4: $NOT_USED = scan 0@ format "%d" 0@
THEN           
    0AF9: samp say_msg "/locate %d" 0@
ELSE
    0AF8: samp add_message_to_chat "Error, use /locate ID" -1
END                                                              
SAMP.CmdRet()

 

 

  

Edited by halfastrc
Link to comment
Share on other sites

@halfastrc Yeap, It's possible:

 

Let's make a command at first for the dialog. (I'm gonna also do a way to open the dialog with the specific key, your opinion was F2).

0B34: samp register_client_command "locate" to_label @IDSET

:IDSET 
SAMP.ShowDialog(1000, "{0070ba}Approach {FFFFFF}- {bdbdbd}Insert ID player", "" , "Set", "Exit", 1)
0B43: samp cmd_ret
0AB2: ret 0

 

The id of dialog is 1000, we'll gonna use the dialog id to define some function on it:

if 0B3C: samp is_dialog_responded id 1000 button 1@ list_item 0 input_text 0 
then
    //Some code                              
end 

 

The first function of the dialog is, how to close the dialog?. (I decided to be: if the player pressed ESC, close the current dialog) :

if 0B3C: samp is_dialog_responded id 1000 button 1@ list_item 0 input_text 0 
then
    if 0AB0: is_key_pressed 27 //If user pressed ESC   
    then 
        0001: wait 10 ms  
        0B47: samp close_current_dialog_with_button 3@ 
    end                               
end

 

Otherwise, go ahead and check the dialog edit box and save it as a string in my ini file.

if 0B3C: samp is_dialog_responded id 1000 button 1@ list_item 0 input_text 0 
then
    if 0AB0: is_key_pressed 27 //If user pressed ESC   
    then 
        0001: wait 10 ms  
        0B47: samp close_current_dialog_with_button 3@ 
    else 
        if 1@ == 1 //If the select button pressed.
        then
            0AC8: 2@ = allocate_memory_size 100  
            0B4A: 2@ = get_current_dialog_editbox_text
            0B47: samp close_current_dialog_with_button 3@ 
            wait 100 //To avoid minor crashes
            0AF5: write_string_to_ini_file 2@ path "CLEO\AHK.ini" section "Main" key "ID" 
            0AC9: free_allocated_memory 2@
        end
    end                               
end

 

Dialog functions have been done, now we have to work on binders and link 'em all to the ini file:

if and
0AB0: key_pressed 97 {NUM1}
8B21: not  samp is_chat_opened //If user chat it's not open at all.
then         
    0AF9: samp say_msg "/approach"
end

 

Link:

if and
0AB0: key_pressed 97 {NUM1}
8B21: not  samp is_chat_opened
then
    alloc 4@ 300
    0AF4: 4@ = read_string_from_ini_file "CLEO\AHK.ini" section "Main" key "ID"
        
    if 0C14: strcmp string1 4@ string2 " "  //If ini file were empty like this
    then 
        chatmsg "{FF0000}Error: {FFFFFF}there is no text exist in ini file." -1
        wait 2000 //To avoid spam in chat
    else           
        0AF9: samp say_msg "/approach %s" 4@
        wait 2000 //To avoid spam in chat
        free 4@
    end
end

 

same as Numpad 2 / 3:

if and
0AB0: key_pressed 98 {NUM2}
8B21: not  samp is_chat_opened
then
    alloc 4@ 300
    0AF4: 4@ = read_string_from_ini_file "CLEO\AHK.ini" section "Main" key "ID"
        
    if 0C14: strcmp string1 4@ string2 " "  //If ini file were empty like this
    then 
        chatmsg "{FF0000}Error: {FFFFFF}there is no text exist in ini file." -1
        wait 2000 //To avoid spam in chat
    else           
        0AF9: samp say_msg "/handcuff %s" 4@
        wait 2000 //To avoid spam in chat
        free 4@
    end
end

if and
0AB0: key_pressed 99 {NUM3}
8B21: not  samp is_chat_opened
then
    alloc 4@ 300
    0AF4: 4@ = read_string_from_ini_file "CLEO\AHK.ini" section "Main" key "ID"
        
    if 0C14: strcmp string1 4@ string2 " " //If ini file were empty like this
    then 
        chatmsg "{FF0000}Error: {FFFFFF}there is no text exist in ini file." -1
        wait 2000 //To avoid spam in chat
    else            
        0AF9: samp say_msg "/arrest %s" 4@
        wait 2000 //To avoid spam in chat
        free 4@
    end
end

 

Binding dialog:

if and
8B21: samp is_chat_opened
8C7E:	is_console_active
then    
    if 0AB0: is_key_pressed 113 //If user pressed F2   
    then
        0AB1: call @IDSET 0
        0001: wait 10 ms
    end
end

 

The whole code should be like this:

{$CLEO .cs}

0000:
repeat
wait 0
until 0AFA: 

if 8AF7: get_samp_base_to 0@
then 
    0A93: end_custom_thread
end
if 0AAB: file_exists "CLEO\AHK.ini" 
then
    0B34: samp register_client_command "locate" to_label @IDSET
else
    wait 2000                                          
    chatmsg "Mod disabled, because you didn't put AHK file in your CLEO Folder." -1
    0A93: end_custom_thread
end
repeat 
    wait 400
until 0AFA: is_samp_structures_available  
  
WHILE TRUE
WAIT 0

if and
8B21: samp is_chat_opened
8C7E:	is_console_active
then    
    if 0AB0: is_key_pressed 113 //If user pressed F2   
    then
        0AB1: call @IDSET 0
        0001: wait 10 ms
    end
end

if 0B3C: samp is_dialog_responded id 1000 button 1@ list_item 0 input_text 0 
then
    if 0AB0: is_key_pressed 27 //If user pressed ESC   
    then 
        0001: wait 10 ms  
        0B47: samp close_current_dialog_with_button 3@ 
    else 
        if 1@ == 1 //If the select button pressed.
        then
            0AC8: 2@ = allocate_memory_size 100  
            0B4A: 2@ = get_current_dialog_editbox_text
            0B47: samp close_current_dialog_with_button 3@ 
            wait 100 //To avoid minor crashes
            0AF5: write_string_to_ini_file 2@ path "CLEO\AHK.ini" section "Main" key "ID" 
            0AC9: free_allocated_memory 2@
        end
    end                               
end

if and
0AB0: key_pressed 97 {NUM1}
8B21: not  samp is_chat_opened
then
    alloc 4@ 300
    0AF4: 4@ = read_string_from_ini_file "CLEO\AHK.ini" section "Main" key "ID"
        
    if 0C14: strcmp string1 4@ string2 " "  
    then 
        chatmsg "{FF0000}Error: {FFFFFF}there is no text exist in ini file." -1
        wait 2000 //To avoid spam in chat
    else            
        0AF9: samp say_msg "s /approach %s" 4@
        free 4@ 
        wait 2000 //To avoid spam in chat
    end
end

if and
0AB0: key_pressed 98 {NUM2}
8B21: not  samp is_chat_opened
then
    alloc 4@ 300
    0AF4: 4@ = read_string_from_ini_file "CLEO\AHK.ini" section "Main" key "ID"
        
    if 0C14: strcmp string1 4@ string2 " "  
    then 
        chatmsg "{FF0000}Error: {FFFFFF}there is no text exist in ini file." -1
        wait 2000 //To avoid spam in chat
    else           
        0AF9: samp say_msg "s /handcuff %s" 4@
        wait 2000 //To avoid spam in chat
        free 4@
    end
end

if and
0AB0: key_pressed 99 {NUM3}
8B21: not  samp is_chat_opened
then
    alloc 4@ 300
    0AF4: 4@ = read_string_from_ini_file "CLEO\AHK.ini" section "Main" key "ID"
        
    if 0C14: strcmp string1 4@ string2 " "  
    then 
        chatmsg "{FF0000}Error: {FFFFFF}there is no text exist in ini file." -1
        wait 2000 //To avoid spam in chat
    else            
        0AF9: samp say_msg "s /arrest %s" 4@
        wait 2000 //To avoid spam in chat
        free 4@
    end
end

END //Looper

:IDSET 
SAMP.ShowDialog(1000, "{0070ba}Approach {FFFFFF}- {bdbdbd}Insert ID player", "" , "Change", "Exit", 1)
0B43: samp cmd_ret
0AB2: ret 0

 

You have to make AHK.ini file otherwise the mod will be disabled automatically:

[Main]
ID=" "

 

If you still had a problem/help something like that. feel free.

 

EDIT:

Just realized I did something wrong with the /locate. this is the right function for this command. as you wanted

:IDSET
SAMP.IsCommandTyped(5@)
if 
0AD4: 5@ = scan_string 5@ format "%d" 6@  
else_jump @IDSET_FAIL 
0AF1: write_int 6@ to "CLEO\AHK.ini" section "Main" key "ID"  
jump @IDSET_DONE 

:IDSET_FAIL
chatmsg "{FF0000}Error: {FFFFFF}Use /locate <id>" -1

:IDSET_DONE
0B43: samp cmd_ret

 

Advice: If you are interested, try to make a function that you are able to enable/disable the hotkey. that would be useful because sometimes maybe you intended to stop doing duty and get reset and chilling around. so the binders don't interface with your gameplay.

Edited by D J C
Link to comment
Share on other sites

you script DJC work perfectly, thx this will be useful to me

 

Thx, Nic and DJC, you helped me a lot. I just have two more question

 

 I have this script too in AHK:

F12::
	addChatMessage("{32cd32}| INFO |{ffffff} Auto lawyer active!") 
    Loop{
        if(RegExMatch(getChatLineEx(),"\QFREEDOM\E(.*)\[(.*)\]", out)){
            SendInput {F6}/release %out2%{enter}
            Sleep,1000
        }
    }
    return

F11:: 
    Reload
        addChatMessage("{32cd32}| INFO |{ffffff} Auto lawyer desactive!") 
    return 
}
return

Basically in this script I use a Regex to take a ID from a determined line of the chat, in the case, the line "FREEDOM" and send a command when this happened.

 

image.png.0350ea0d045cbdd675472e13c40345c1.png

 

When this happened, automatically the script send the command "/release 1"

 

In .cs is possible do this? (Read a determined chatline and send a command).

 

 

Click in Dialog:

~ESC::
~F6::
	menu := 0
	return

PGUP::
	SendInput {F6}/prisoner{enter}
    Sleep,100
	menu := 1
    return
    
~LButton::
    Time := A_TickCount
        while(isDialogOpen()){
            if (A_TickCount - Time > 500){
                return
            }
        }
        
checkdialogMenu:
    if (isDialogButtonSelected() == 1){
        menu := 0
    }
    if (menu == 1){
        menu := 0
        line_num  := getDialogLineNumber()
        line_text  := getDialogLine(line_num)

        if(RegExMatch(line_text,"(.*)\[(.*)\]", out)){
            SendInput {F6}/release %out2%{enter} 

            return
        }   
    }
    return

Basically when I press PGUP the script open a dialog and when click with the mouse in a nick from the list, the script automatically send a command to that ID.

 

image.png.c3598221b7f32057aa0a4e8343054dc1.png

 

For example, if I click in Bemanely[32], automatically the script will send in chat "/release 32", in .cs is possible do this too?

 

I appreciate any help thx

 

 

Edited by halfastrc
Link to comment
Share on other sites

6 hours ago, halfastrc said:

you script DJC work perfectly, thx this will be useful to me

 

Thx, Nic and DJC, you helped me a lot. I just have two more question

 

 I have this script too in AHK:


F12::
	addChatMessage("{32cd32}| INFO |{ffffff} Auto lawyer active!") 
    Loop{
        if(RegExMatch(getChatLineEx(),"\QFREEDOM\E(.*)\[(.*)\]", out)){
            SendInput {F6}/release %out2%{enter}
            Sleep,1000
        }
    }
    return

F11:: 
    Reload
        addChatMessage("{32cd32}| INFO |{ffffff} Auto lawyer desactive!") 
    return 
}
return

Basically in this script I use a Regex to take a ID from a determined line of the chat, in the case, the line "FREEDOM" and send a command when this happened.

 

image.png.0350ea0d045cbdd675472e13c40345c1.png

 

When this happened, automatically the script send the command "/release 1"

 

In .cs is possible do this? (Read a determined chatline and send a command).

 

Yes, it is.

 

{$CLEO}
{$INCLUDE SF}
0000:

repeat
wait 0
until SAMP.Available()

0BE3: raknet setup_incoming_rpc_hook @login

while true
wait 0

END

:login
0BE5: raknet 31@ = get_hook_param PARAM_PACKETID
if 31@ == RPC_ScrClientMessage
then
    alloc 27@ 256
    0c11: memset destiantion 27@ value 0 size 256
       
    0BE5: raknet 30@ = get_hook_param PARAM_BITSTREAM
    0BE7: raknet 29@ = bit_stream_read 30@ type BS_TYPE_INT //color
    0BE7: raknet 28@ = bit_stream_read 30@ type BS_TYPE_INT //lenght
    0BE8: raknet bit_stream 30@ read_array 27@ size 28@ //string
    0C0D: struct 27@ offset 28@ size 1 = 0
    
    if 0C29: $NOT_USED = stristr string1 27@ string2 "FREEDOM"
    then
        alloc 26@ 50
        0AA5: call 0x8220AD num_params 4 pop 4 25@v 26@ "%s[%d]" 27@
        //26@=nick | 25@=ID
        say "/release %d" 25@
        free 26@
    end
        
    free 27@
end
0BE0: raknet hook_ret true  

P.S: You need SAMPFUNCS to use this function.

 

Right now I don't have enough time for 'click in dialog' mod, I'll look into it in a couple of hours.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.