CLEO Help help

CLEO related
Status
Not open for further replies.

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
[shcode=cpp]{$CLEO}

:NONAME_02
WAIT 0 MS

0B34: "Find" TO @Find
0B34: "FindON" TO @FindON

WHILE TRUE
 WAIT 0 MS
  IF 0@ == TRUE
    THEN
    alloc 1@ = 360
    0B75: samp get_chat_string 99 text_to 1@ prefix_to -1 -1 -1
    WAIT 200 MS
    IF
      0AD4: 2@ SCAN 1@ "%*s says: Am dat find pe %d" 4@
    THEN
    say "/find %d" 4@ 
    END
    free 1@
  END
END        
    
    
 :FindON
 SAMP.IsCommandTyped(1@)
 IF 0AD4: 2@ SCAN 1@ "%d" 3@
   THEN
   IF 3@ == 1
     THEN 
     CHATMSG "On" -1
     0@ = TRUE
     ELSE
     IF 3@ == 0
       THEN 
       CHATMSG "Off" -1
       0@ = FALSE
       END
    END
 END
 SAMP.CmdRet         
    
      
 :Find
 SAMP.IsCommandTyped(1@)
 IF 0AD4: 2@ SCAN 1@ "%d" 3@
   THEN
   SAY "Am dat find pe %d" 3@ 
 END
 SAMP.CmdRet         [/shcode]

script execute 0af9 (say /find %d) x2 times in chat, i tried adding wait but it still saying two times in a row and i really don't know why :d
 

Rough

Active member
Joined
Mar 7, 2015
Messages
42
Reaction score
4
And.. uhm.. yeah, another question..

for

"

IF 3@ == 1
THEN
CHATMSG "On" -1
0@ = TRUE
ELSE
IF 3@ == 0
THEN
CHATMSG "Off" -1
0@ = FALSE

"

is there a way instead of "/findon 1 or 0 " to use " /findon ONLINE " or " /findon OFFLINE" ? thanks
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,125
Reaction score
149
@doroftel
I'd reset the triggering boolean after the "say" like:

say "/find %d" 4@
0@ = false

it will stop the loop (deactivate the command), if you'd like to keep it activated but avoid multiple triggers you could do 2 things:
1. Copy the last chat string, compare if the current one is the same and trigger the "say" only if it's different
2. Use raknet hook and allow checks only when new message arrives (like this: ugbase.eu/Thread-Samp-detect-new-message-in-chat)



@Rough
I used something like this:

0B35: samp 25@ = get_last_command_params
if
0C18: 2@ = strstr string1 25@ string2 "online"
then
//but I'm not sure about 0C18 (can't remember if this opcode was replaced in new sampfuncs or not)
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
monday said:
@Rough
I used something like this:

0B35: samp 25@ = get_last_command_params
if
0C18: 2@ = strstr string1 25@ string2 "online"
then
//but I'm not sure about 0C18 (can't remember if this opcode was replaced in new sampfuncs or not)

yea it should work, with this opcode if i remember well, we can make license for script :)

or ... if comparasion between a string and another string was possible, script below should work i think
[shcode=cpp]
VAR
2@ : string
3@ : string
4@ : string
END


:NONAME_04
WAIT 0
JUMP @NONAME_04

:CMD
SAMP.IsCommandTyped(0@)
IF 0AD4: 1@ SCAN 0@ FORMAT "%s" 2@
 THEN
 0AF4: 3@ = read_string_from_ini_file "cleo\config.ini" section "SectionName" key "KeyON"
 IF 2@ == 3@
   THEN CHATMSG "Rahat." -1
   ELSE
   0AF4: 4@ = read_string_from_ini_file "cleo\config.ini" section "SectionName" key "KeyOFF"
   IF 2@ == 4@
     THEN CHATMSG "Rahat 2." -1
     END
  END
END
SAMP.CmdRet    [/shcode]

/////////////////////

is there any way to deactivate siren sound?(just for me, other players can hear it )
 
Status
Not open for further replies.
Top