Jump to content

Read chat for string and push automatic command if matched


Recommended Posts

Hi all,

 

 

I basically need the same thing as in the link that I provided, a cleo mod that reads the chat every second and if it finds a specific string, an automatic command is pushed in the chat once. I tried numerous times with ChatGPT as I am not that far into cleo scripting, but game always freezes.

 

@ D J C tagging you sir because you helped to build the previous mod.

 

Thank you all in advance!

Link to comment
Share on other sites

Let me also explain why I need it. I often lose connection to the server, however I want to be online when I leave home. I want to use 3 mods for this, 2 working perfectly. Autologin to detect the login screen and type my password automatically and from another mod I will use the /recon command which resets the connection and removes my clan tag to escape the bug with registering new account with the account name. What I need is a 3rd script that looks for "Lost connection to the server. Reconnecting.." when it sees this string, push /recon, resets once again the connection and removes my tag, then Autologin will log me in instantly. That is my plan to stay online even if I lose connection.

Link to comment
Share on other sites

Posted (edited)

Hello, 

im gonna give you this and from it edit it however you want.

{$CLEO .cs}

0000: NOP



thread "test"



repeat
    wait 10
until SAMP.Available 



while true
wait 10
        alloc 10@ 256
        0B75: samp get_chat_string 99 text_to 10@ -1 -1 -1   
        if
            0AD4: $bla = scan_string 10@ format "Text Matched here" 16@
        then    
              say "/yourcommand"
        end
        free 10@
end

 

Edited by AdeM nWo
Link to comment
Share on other sites

It again freezes my game, does not even crash, just closes it. Could it be a conflict with another script? Can you try if it works for you? Big thank you!

Link to comment
Share on other sites

Hello!

 

It would have been great if I could help you with CLEO, but unfortunately, I haven't been active in that field for several years. If you have any questions about LUA programming, I'm at your service, which it offers extensive libraries and is widely used in game development, providing more flexibility for various types of mods beyond just GTA SA and has a large and active community, providing extensive resources, tutorials, and support.

 

CLEO, uses Sanny Builder and SCM language, which can be more complex and less intuitive for new programmers, performance can vary depending on the complexity of the scripts, and it may not be as optimized as LUA for certain tasks, and this is the reason why I moved to LUA programming.

Link to comment
Share on other sites

Posted (edited)
{$CLEO .cs}

0000: NOP

thread "testt"

repeat
    wait 10
until SAMP.Available

while true
    wait 10
    alloc 10@ 256
    0B75: samp get_chat_string 99 text_to 10@ -1 -1 -1
    if
        0C29:1@ = stristr string1 10@ string2 "Text matched here"
    then
            say "/yourcommand"
            wait 1000
    end
end


This should work good for you !

Edited by AdeM nWo
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.