CLEO Help chat reader help

CLEO related
Status
Not open for further replies.

LupusTT

Member
Joined
Dec 27, 2017
Messages
7
Reaction score
0
[font=arial, sans-serif]How can I make a mod to read the chat and when I get pm from a player to write something in the chat?[/font]
[font=arial, sans-serif][font=arial, sans-serif]I tried something but got a crash[/font][/font]
 

_=Gigant=_

Well-known member
Joined
Mar 21, 2017
Messages
353
Reaction score
16
LupusTT said:
[font=arial, sans-serif]How can I make a mod to read the chat and when I get pm from a player to write something in the chat?[/font]
[font=arial, sans-serif][font=arial, sans-serif]I tried something but got a crash[/font][/font]

something ? you mean custom input for reply on pm (which is same as the T input) or you want to tell to mod what to say (automatic reply some text...) .... you should show us what you've tried....
 

LupusTT

Member
Joined
Dec 27, 2017
Messages
7
Reaction score
0
{$CLEO}


:NONAME_02
WAIT 0 MS

:NONAME_03
WAIT 0 MS
IF 8AFA: NOT
THEN JUMP @NONAME_03
END
WAIT 3000



0B34: Create Command "AgON" to @AgON label


WHILE TRUE
WAIT 0 MS
IF 23@ == 1
THEN
ALLOC 4@ = 969
0B75: samp get_chat_string 99 text_to 4@ prefix_to 5@ color_to 6@ prefix_color_to 7@
IF OR
0AD4: 8@ = scan_string 4@ format "Lupus.CROWN: sal" 9@v 11@v 10@
THEN
SAY "sugus" 9@v
END
free 4@
END
END




:AgON
SAMP.IsCommandTyped(0@)
IF 8AD4: NOT 1@ SCAN 0@ FORMAT "%D" 2@
THEN JUMP @ERROR_AgON
END
IF 2@ == 1
THEN CHATMSG "test on " -1
23@ = 1
ELSE
IF 2@ == 0
THEN CHATMSG "test of" -1
23@ = 0
END
END
SAMP.CmdRet

:ERROR_AgON
SAMP.CmdRet


i just edit a mod
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
149
here's some template you could use

Code:
{$CLEO}
{$INCLUDE SF}
0000:
repeat
wait 50
until 0AFA:  is_samp_available
0B34: samp register_client_command "activate" to_label @activate
0BE3: raknet setup_incoming_rpc_hook @on_new_chatline

0AC8: 31@ = allocate_memory_size 260 //chatline
0AC8: 30@ = allocate_memory_size 260 
 
27@ = 1 // makes the mod activated after launching the game
 
while true
wait 0

    /*
    if key_down 48
    then
    24@ = 1
    end
    */
    
    if and
    27@ == 1
    24@ == 1
    then
    24@ = 0 
    samp.GetChatString(99, 31@, 0, 0, 0)     
    //chatmsg "String detected: %s" -1 31@  
        if
        //0AD4: 0@ = 31@ scan_string "hello %d" 29@
        0C14: strcmp string1 31@ string2 "----------- [Hello] -----------"
        then
        //0AD3: 30@ = format "Command ready to be entered: /pm %d hello my friend" 29@
        //chatmsg 30@ -1  // replace it with "say 30@"  
        say "Whats up dude?" 
        end
    end
end


:activate
0B12: 27@ = 27@ XOR 1
if 27@ == 1
then
0AD1: show_formatted_text_highpriority "activated" time 700 
else
0AD1: show_formatted_text_highpriority "deactivated" time 700
end
samp.CmdRet

:on_new_chatline
0BE5: raknet 23@ = get_hook_param PARAM_PACKETID
if 23@ == RPC_ScrClientMessage
then
24@ = 1
end
0BE0: raknet hook_ret true

it checks for the exact string using the following line:

Code:
0C14: strcmp string1 31@ string2 "----------- [Hello] -----------"

to check whether some string contains something you could use 0C18 opcode which returns pointer to given sub-string (desired piece of text) if it's found. To get the content or the author of the message you could also use 0AD4 opcode I guess
 
Status
Not open for further replies.
Top