CLEO Help Help autocall

CLEO related
Status
Not open for further replies.

Rough

Active member
Joined
Mar 7, 2015
Messages
42
Reaction score
4
Hello.. I have a problem.. I'm trying to make a mod which scan a string and get for exemple 7 numbers from it, then use it as /call ..

take a look and can you please tell me what I am doing wrong? I mean, maybe I didn't understand very well  how to scan strang and get numbers from it but i'd like to learn. Thank you very much! appreciate!

Code:
0B34: samp register_client_command "call" to_label @call

//0AF8: samp add_message_to_chat "{660000}autosms..cs - Working" color 0x660000

wait 1000
thread "autocall"

:Noname_05
wait 0
jump @Noname_05


:call
  SAMP.IsCommandTyped(0@)
IF 0AD4: 1@ = scan_string 0@ format "%d" 2@
JF @ERROR
IF SAMP.IsPlayerConnected(2@)
JF @ERROR_2
3@ = SAMP.GetPlayerNickname(2@)
Say "/number %s" 3@
jump @scan                                           
SAMP.CmdRet


 : scan 
alloc 0@ = 145
alloc 1@ = 25
0B75: samp get_chat_string 99 text_to 0@ prefix_to 1@ color_to -1 prefix_color_to -1 //citesti linia din chat, 99 = ultima
    if
    0C29: 3@ = stristr string1 0@ string2 "{999999}Name: %s, Phone number: %s%s%s-%s%s%s%s" 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ //cauti un string in alt string, cauti \'potato\' in ultimul mesaj din chat
  then
  Say "/call %s%s%s%s%s%s%s" 6@ 7@ 8@ 9@ 10@ 11@ 12@
  end 
  
free 0@
free 1@





:error
chatmsg "nu-i buna sintaxa, iti tre' un id" -1
samp.CmdRet()

:error_2
chatmsg "crash" -1
samp.CmdRet()

// I was thinking to make it write into .ini the number then read it from .ini file.. but I don't know how to get info from string exactly and then write it elsewhere.. And I also don't understand how alocating memory works.. Thank you very much!
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
17
Location
Romania
@Rough , I didn't tested above example I just give it to you and this have a little bugs, sry :(

[shcode=cpp]

{$CLEO}
  
    :Noname_03
    wait 0
  
    :Noname_04
    WAIT 0
    IF SAMP.Available()  
    JF @Noname_04
  
    0B34: samp register_client_command "call" to_label @call
    0C6A: $CUSTOM_THREAD = create_custom_thread_at_label @Call_Function
    CHATMSG "Rough smecher dala mare ! " -1
    $Call_FUNCTION = FALSE
      
    :Noname_05
    WAIT 0
    JUMP @Noname_05
  
   :Call
   SAMP.IsCommandTyped(0@)
   Say "/number %s" 0@
   $Call_FUNCTION = TRUE
   SAMP.CmdRet
  
   :Call_Function
   WHILE TRUE
   WAIT 0
   IF $Call_FUNCTION == TRUE
     THEN
     WAIT 300 MS
     0AC8: $TEXT = allocate_memory_size 360
     0B75: samp get_chat_string 99 text_to $TEXT prefix_to 3@ color_to 4@ prefix_color_to 5@  
     IF OR
     0AD4: $SCAN_EN = scan $TEXT format "{999999}Name: %s Phone number: %s" 21@v 25@s
     0AD4: $SCAN_RO = scan $TEXT format "{999999}Nume: %s Numar de telefon: %s" 21@v 25@s
        THEN
        SAY "/call %s" 25@s
       END
       $Call_FUNCTION = FALSE
     END
   END
[/shcode] it should work 100%
 
Status
Not open for further replies.
Top