Вопросы по CLEO-скриптингу

iTz_WEEZY

Известный
298
85
Как использовать этот опкод: 0209: 10@ = random_int_in_ranges -3000 7000 ?
Записать как функцию (ну ли как там наз.ся) или строчить перед каждым Wait?
Прост у меня код в 3к строк и 500 этих Вайтов
 

hnnssy

Известный
Друг
2,684
2,749
Как использовать этот опкод: 0209: 10@ = random_int_in_ranges -3000 7000 ?
Записать как функцию (ну ли как там наз.ся) или строчить перед каждым Wait?
Прост у меня код в 3к строк и 500 этих Вайтов
даже если и сделаешь функцией, придётся её вызов сточить перед каждым wait
 

Сэнд

Известный
Проверенный
436
212
CLEO:
{$CLEO .cs}
0000: NOP

repeat
    wait 0
until SAMP.Available()

0B34: samp register_client_command "mh" to_label @comanda
22@ = 0

const
DIALOG_STYLE_MSGBOX = 0
DIALOG_STYLE_INPUT = 1
DIALOG_STYLE_LIST = 2
DIALOG_STYLE_PASSWORD = 3
end

while true
  wait 0
  if
  22@ == 1
  then
  0ac8: alloc 4@ size 64
   0AD3: string 4@ format "_text1_%c_text2_%c_text3_%c_text4_%c_text5_" 0xA 0xA 0xA 0xA
   0B3B: samp show_dialog id 2 caption "dialog" text 4@ button_1 "ok" button_2 "close" style DIALOG_STYLE_LIST
   wait 20
   0ac9: free 4@
   22@ = 0
   end
  end

  if 0B3C: samp dialog_respond 2 button 1 list_item 2@ input_text 0
    then
       if 2@ == 0
        then
        0AC6: 13@ = label @label1 offset
         0B3B: samp show_dialog id 3 caption "dialog" text 13@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end

       if 2@ == 1
        then
        0AC6: 14@ = label @label2 offset
        0B3B: samp show_dialog id 4 caption "dialog" text 14@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end

       if 2@ == 2
        then
        0AC6: 15@ = label @label3 offset
        0B3B: samp show_dialog id 5 caption "dialog" text 15@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end

        if 2@ == 4
        then
        0AC6: 16@ = label @label4 offset
        0B3B: samp show_dialog id 6 caption "dialog" text 16@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end

        if 2@ == 5
        then
        0AC6: 17@ = label @label5 offset
        0B3B: samp show_dialog id 7 caption "dialog" text 17@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end
    end


:label1
hex
"some text 1" 00
end

:label2
hex
"some text 2" 00
end

:label3
hex
"some text 3" 00
end

:label4
hex
"some text 4" 00
end

:label5
hex
"some text 5" 00
end

:comanda
if 22@ == 1
     then
     22@ = 0
     else
     22@ = 1
end
0B43: samp cmd_ret

Главный диалог работает, дочерние открываться не хотят. Как исправить?
 
Последнее редактирование:

hnnssy

Известный
Друг
2,684
2,749
CLEO:
{$CLEO .cs}
0000: NOP

repeat
    wait 0
until SAMP.Available()

0B34: samp register_client_command "mh" to_label @comanda
22@ = 0

const
DIALOG_STYLE_MSGBOX = 0
DIALOG_STYLE_INPUT = 1
DIALOG_STYLE_LIST = 2
DIALOG_STYLE_PASSWORD = 3
end

while true
  wait 0
  if
  22@ == 1
  then
  0ac8: alloc 4@ size 64
   0AD3: string 4@ format "_text1_%c_text2_%c_text3_%c_text4_%c_text5_" 0xA 0xA 0xA 0xA
   0B3B: samp show_dialog id 2 caption "dialog" text 4@ button_1 "ok" button_2 "close" style DIALOG_STYLE_LIST
   wait 20
   0ac9: free 4@
   22@ = 0
   end
  end

  if 0B3C: samp dialog_respond 2 button 1 list_item 2@ input_text 0
    then
       if 2@ == 0
        then
        0AC6: 13@ = label @label1 offset
         0B3B: samp show_dialog id 3 caption "dialog" text 13@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end

       if 2@ == 1
        then
        0AC6: 14@ = label @label2 offset
        0B3B: samp show_dialog id 4 caption "dialog" text 14@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end

       if 2@ == 2
        then
        0AC6: 15@ = label @label3 offset
        0B3B: samp show_dialog id 5 caption "dialog" text 15@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end

        if 2@ == 4
        then
        0AC6: 16@ = label @label4 offset
        0B3B: samp show_dialog id 6 caption "dialog" text 16@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end

        if 2@ == 5
        then
        0AC6: 17@ = label @label5 offset
        0B3B: samp show_dialog id 7 caption "dialog" text 17@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
        end
    end


:label1
hex
"some text 1" 00
end

:label2
hex
"some text 2" 00
end

:label3
hex
"some text 3" 00
end

:label4
hex
"some text 4" 00
end

:label5
hex
"some text 5" 00
end

:comanda
if 22@ == 1
     then
     22@ = 0
     else
     22@ = 1
end
0B43: samp cmd_ret

Главный диалог работает, дочерние открываться не хотят. Как исправить?
мб потому что проверку на диалог_респонд надо в цикл пихать?
 

Сэнд

Известный
Проверенный
436
212
CLEO:
{$CLEO .cs}
0000: NOP

repeat
     wait 0
until SAMP.Available()

0B34: samp register_client_command "mh" to_label @comanda
22@ = 0

const
DIALOG_STYLE_MSGBOX = 0
DIALOG_STYLE_INPUT = 1
DIALOG_STYLE_LIST = 2
DIALOG_STYLE_PASSWORD = 3
end

while true
   wait 0
   if
   22@ == 1
   then
   0ac8: alloc 4@ size 64
    0AD3: string 4@ format "_text1_%c_text2_%c_text3_%c_text4_%c_text5_" 0xA 0xA 0xA 0xA
    0B3B: samp show_dialog id 2 caption "dialog" text 4@ button_1 "ok" button_2 "close" style DIALOG_STYLE_LIST
    wait 20
    0ac9: free 4@
    22@ = 0
    end
   end

while true
   if 0B3C: samp dialog_respond 2 button 1 list_item 2@ input_text 0
     then
        if 2@ == 0
         then
         0AC6: 13@ = label @label1 offset
          0B3B: samp show_dialog id 3 caption "dialog" text 13@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end

        if 2@ == 1
         then
         0AC6: 14@ = label @label2 offset
         0B3B: samp show_dialog id 4 caption "dialog" text 14@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end

        if 2@ == 2
         then
         0AC6: 15@ = label @label3 offset
         0B3B: samp show_dialog id 5 caption "dialog" text 15@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end

         if 2@ == 4
         then
         0AC6: 16@ = label @label4 offset
         0B3B: samp show_dialog id 6 caption "dialog" text 16@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end

         if 2@ == 5
         then
         0AC6: 17@ = label @label5 offset
         0B3B: samp show_dialog id 7 caption "dialog" text 17@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end
     end
end

:label1
hex
"some text 1" 00
end

:label2
hex
"some text 2" 00
end

:label3
hex
"some text 3" 00
end

:label4
hex
"some text 4" 00
end

:label5
hex
"some text 5" 00
end

:comanda
if 22@ == 1
      then
      22@ = 0
      else
      22@ = 1
end
0B43: samp cmd_ret
:D
 

hnnssy

Известный
Друг
2,684
2,749
CLEO:
{$CLEO .cs}
0000: NOP

repeat
     wait 0
until SAMP.Available()

0B34: samp register_client_command "mh" to_label @comanda
22@ = 0

const
DIALOG_STYLE_MSGBOX = 0
DIALOG_STYLE_INPUT = 1
DIALOG_STYLE_LIST = 2
DIALOG_STYLE_PASSWORD = 3
end

while true
   wait 0
   if
   22@ == 1
   then
   0ac8: alloc 4@ size 64
    0AD3: string 4@ format "_text1_%c_text2_%c_text3_%c_text4_%c_text5_" 0xA 0xA 0xA 0xA
    0B3B: samp show_dialog id 2 caption "dialog" text 4@ button_1 "ok" button_2 "close" style DIALOG_STYLE_LIST
    wait 20
    0ac9: free 4@
    22@ = 0
    end
   end

while true
   if 0B3C: samp dialog_respond 2 button 1 list_item 2@ input_text 0
     then
        if 2@ == 0
         then
         0AC6: 13@ = label @label1 offset
          0B3B: samp show_dialog id 3 caption "dialog" text 13@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end

        if 2@ == 1
         then
         0AC6: 14@ = label @label2 offset
         0B3B: samp show_dialog id 4 caption "dialog" text 14@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end

        if 2@ == 2
         then
         0AC6: 15@ = label @label3 offset
         0B3B: samp show_dialog id 5 caption "dialog" text 15@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end

         if 2@ == 4
         then
         0AC6: 16@ = label @label4 offset
         0B3B: samp show_dialog id 6 caption "dialog" text 16@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end

         if 2@ == 5
         then
         0AC6: 17@ = label @label5 offset
         0B3B: samp show_dialog id 7 caption "dialog" text 17@ button_1 "ok" button_2 "" style DIALOG_STYLE_MSGBOX
         end
     end
end

:label1
hex
"some text 1" 00
end

:label2
hex
"some text 2" 00
end

:label3
hex
"some text 3" 00
end

:label4
hex
"some text 4" 00
end

:label5
hex
"some text 5" 00
end

:comanda
if 22@ == 1
      then
      22@ = 0
      else
      22@ = 1
end
0B43: samp cmd_ret
:D
pizdec
 
  • Нравится
Реакции: Bogach

Сэнд

Известный
Проверенный
436
212
Можно как-нибудь убрать движение камеры после смерти персонажа? Чтоб не было этой херни шатающейся, а я мог двигать камерой так, как при живом персонаже. Если можно, то как? Вроде в МТА видел такую фишку.