CLEO Help samp server messages via chat

CLEO related
Status
Not open for further replies.

Rat

Active member
Joined
Sep 24, 2013
Messages
137
Reaction score
0
is there a way to get a server message whenever it prompts and store it to a variable in cleo?
for example:

[16:01:55] <Moron> i'm dumb.
[16:01:59] Your fuel is low.
[16:02:04] <AssWipe> admeen?
 

Rat

Active member
Joined
Sep 24, 2013
Messages
137
Reaction score
0
DuFF link said:
Try to use SAMP.GetChatString
can you give me an example?
can you send me a link to its documentation?
i don't know how to use that or this:
0B75: samp get_chat_string 1@ text_to 2@ prefix_to 3@ color_to 4@ prefix_color_to 5@
 

DuFF

Member
Joined
Apr 5, 2014
Messages
20
Reaction score
0
I think this is what you want, I'm not an expert, but it should work (I haven't tested it yet)

Code:
{$CLEO .cs}

thread 'MESSAGES'

:Load
wait 200 
if
  SAMP.Available
else_jump @Load

0B34: samp register_client_command "start" to_label @START
0B34: samp register_client_command "stop" to_label @STOP

0AC8: 1@ = allocate_memory_size 260
0AC8: 2@ = allocate_memory_size 260
0AC8: 3@ = allocate_memory_size 260
0AC8: 4@ = allocate_memory_size 260

while true
    wait 0
    SAMP.GetChatString(99, 1@, 2@, 3@, 4@)
    if or
    0C14: strcmp string1 1@ string2 "Your fuel is low"
    0C14: strcmp string1 1@ string2 "Next message.."
    then
        //Store 1@ where you want    
    end
end

:START
31@ = 1
SAMP.CmdRet()


:STOP
31@ = 0
SAMP.CmdRet()
 

Rat

Active member
Joined
Sep 24, 2013
Messages
137
Reaction score
0
DuFF link said:
I think this is what you want, I'm not an expert, but it should work (I haven't tested it yet)

Code:
{$CLEO .cs}

thread 'MESSAGES'

:Load
wait 200 
if
  SAMP.Available
else_jump @Load

0B34: samp register_client_command "start" to_label @START
0B34: samp register_client_command "stop" to_label @STOP

0AC8: 1@ = allocate_memory_size 260
0AC8: 2@ = allocate_memory_size 260
0AC8: 3@ = allocate_memory_size 260
0AC8: 4@ = allocate_memory_size 260

while true
    wait 0
    SAMP.GetChatString(99, 1@, 2@, 3@, 4@)
    if or
    0C14: strcmp string1 1@ string2 "Your fuel is low"
    0C14: strcmp string1 1@ string2 "Next message.."
    then
        //Store 1@ where you want    
    end
end

:START
31@ = 1
SAMP.CmdRet()


:STOP
31@ = 0
SAMP.CmdRet()
thanks. imma take a look
 

Rat

Active member
Joined
Sep 24, 2013
Messages
137
Reaction score
0
Code:
{$CLEO .cs}

thread 'MESSAGES'

:Load
wait 200 
if
    SAMP.Available
else_jump @Load

0B34: samp register_client_command "start" to_label @START
0B34: samp register_client_command "stop" to_label @STOP

0AC8: 1@ = allocate_memory_size 260
0AC8: 2@ = allocate_memory_size 260
0AC8: 3@ = allocate_memory_size 260
0AC8: 4@ = allocate_memory_size 260

while true
    wait 0
    SAMP.GetChatString(99, 1@, 2@, 3@, 4@)
    if
        0C14:   strcmp string1 1@ string2 "Your fuel is low."
    then
        018C:   play_sound 1084 at 0.0 0.0 0.0  
    end
end

:START
31@ = 1
SAMP.CmdRet()


:STOP
31@ = 0
SAMP.CmdRet()
i tried draining my fuel until the server message appeared but the script didn't play the sound.
i did activate it with /start.
 

Rat

Active member
Joined
Sep 24, 2013
Messages
137
Reaction score
0
i got it working.  :celeral_spitting:
the problem though is the sound gets triggered when the server message becomes the 2nd to the last message.

[01:20:39] Your fuel is low.
[01:20:44] <playa> asdf

here's the code:
Code:
{$CLEO .cs}

thread 'MESSAGES'

REPEAT
    wait 0
UNTIL 0AFA:   SAMP_IS_READY

while true
    wait 0
    0AC8:   1@ = allocate_memory_size 145
    0AB1:   call @getChatEntryText 1 id 99 to 1@
    
    if
        0C18:   2@ = strstr string1 1@ string2 "Your fuel is low."
    then
        6@ = Audiostream.Load("CLEO/snds/TOASTY.mp3")
        Audiostream.PerformAction(6@, PLAY)
        wait 100
    end
end

:GETCHATENTRYTEXT
IF 0AA2: 1@ = "samp.dll"
THEN
    1@ += 0x21A0E4
    0A8D: 1@ readMem 1@ sz 4 vp 0
    1@ += 0x132
    0@ *= 0xFC
    005A: 1@ += 0@ 
    1@ += 0x20
    0AA3: 1@
END
0AB2: ret 1 1@
 
Status
Not open for further replies.
Top