CLEO Help help with cleo invite

CLEO related

florezyatina

Member
Joined
Nov 3, 2021
Messages
17
Reaction score
0
Location
123
what is wrong here?
Code:
:Noname_691
0AF9: samp say_msg "/invite %d" 2@
0001: wait 1150 ms
00D6: if and
0B4C:  samp is_dialog_active 53
0019:   TIMERA > 7000
004D: jump_if_false @Noname_771
0BC9: samp send_dialog_response dialog 53 button 1 listitem 0 input ""
wait 1150
0AF9: samp say_msg "/rank %d" 2@
0BC9: samp send_dialog_response dialog 54 button 5 listitem 0 input ""
0001: wait 1150 ms
0002: jump @Noname_808
according to my idea, the person should be invited, and if dialog 53 is open, then he clicks on the first one in the dialog box, then writes / rank id of the chela and on the 5 button (this is not the whole code, the error is only in it)
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
270
Location
Pluto
You can't use Say Opcode to format strings, you can only pass a string that is already formatted. You should first format the string, and then pass it to the SAY Opcode:
PHP:
:Noname_691
    // change all 0@ seen in this section into any unused local variable
alloc 0@ 21
0AD3: 0@ = format "/invite %d" 2@ // format the string first
0AF9: samp say_msg 0@ // pass it to the SAY Opcode
0001: wait 1150 ms
00D6: if and
0B4C:  samp is_dialog_active 53
0019:   TIMERA > 7000
004D: jump_if_false @Noname_771
0BC9: samp send_dialog_response dialog 53 button 1 listitem 0 input ""
wait 1150
0AD3: 0@ = format "/rank %d" 2@ // format the string first
0AF9: samp say_msg 0@ // pass it to the SAY Opcode
free 0@
0BC9: samp send_dialog_response dialog 54 button 5 listitem 0 input ""
0001: wait 1150 ms
0002: jump @Noname_808
 

blvck0v

Active member
Joined
Feb 23, 2019
Messages
98
Reaction score
51
Location
ugbase.eu
You can't use Say Opcode to format strings, you can only pass a string that is already formatted. You should first format the string, and then pass it to the SAY Opcode:
PHP:
:Noname_691
    // change all 0@ seen in this section into any unused local variable
alloc 0@ 21
0AD3: 0@ = format "/invite %d" 2@ // format the string first
0AF9: samp say_msg 0@ // pass it to the SAY Opcode
0001: wait 1150 ms
00D6: if and
0B4C:  samp is_dialog_active 53
0019:   TIMERA > 7000
004D: jump_if_false @Noname_771
0BC9: samp send_dialog_response dialog 53 button 1 listitem 0 input ""
wait 1150
0AD3: 0@ = format "/rank %d" 2@ // format the string first
0AF9: samp say_msg 0@ // pass it to the SAY Opcode
free 0@
0BC9: samp send_dialog_response dialog 54 button 5 listitem 0 input ""
0001: wait 1150 ms
0002: jump @Noname_808
I never had problems with formated say opcode.
As example:
PHP:
:giveCarKeys
SAMP.IsCommandTyped(0@)
if 0AD4: $NOT_USED = scan_string 0@ format "%d" 1@
then
    say "/givecarkeys %d" 1@ // say opcode in keyword form + server specific cmmd
end
SAMP.CmdRet()
It doesn't matter var type, either strings ints floats, never had this beign a problem.
Keep up the great work!
 
Top