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

ackman31

Новичок
35
0
Почему диалог появляется сразу при запуске самп а не при вводе команды?
 

ackman31

Новичок
35
0
код давай, мы не экстрасенсы
А вдруг...
Код:
{$CLEO}

const
    DIALOG_STYLE_LIST = 2
end

0000: NOP

repeat
    wait 400
until 0AFA:  is_samp_available

0B34: samp register_client_command "teleport" to_label @cmd
0BDE: pause_thread 0 

:cmd
0AC8: 0@ = allocate_memory_size 128 
0ad3: format_stirng 0@ = "Мэрия ЛС%cМэрия СФ%cМэрия ЛВ" 0xA 0xA 
0B3B: samp show_dialog id 17 caption "Список телепортов" text 0@ button_1 "Выбрать" button_2 "Закрыть" style DIALOG_STYLE_LIST
0AC9: free_allocated_memory 0@ 

while true
    wait 0
    if 
        0B3C: samp is_dialog_responded id 17 button 1@ list_item 3@ input_text 0
    then

        0AF8: samp add_message_to_chat "Был выбран пукнт назначения %d" color -1 params 1@ 

        if 
            1@ == 1
        then 
            0AF8: samp add_message_to_chat "А именно: Уря" color -1
            0AF8: samp add_message_to_chat "Элемент №%d" color -1 params 3@

            if 3@ == 0
            then 0AF8: samp add_message_to_chat "Это первый пукнт" color -1
            end

            if 3@ == 1 // Был выбран второй пункт
            then 0AF8: samp add_message_to_chat "Это второй пункт" color -1
            end

            if 3@ == 2 // Был выбран третий пункт
            then 0AF8: samp add_message_to_chat "Это третий пункт" color -1
            end
        else 
            0AF8: samp add_message_to_chat "Список телепортов закрыт" color -1
        end 
    end
end
0B43: samp cmd_ret

Хах, проблему как-то решил, но при вводе команды гта зависает и ничего сделать нельзя
 
Последнее редактирование модератором:

Garrus

Известный
159
20
Доброго времени суток. Решил написать свой скрипт телепорта, используя DXUT диалоги, но столкнулся с непонятным багом. Дело в том, что в произвольный момент, когда выбираешь пункт в одном диалоге, может сработать обработчик от другого диалога и, как следствие, будет выполнено совершенно другое действие. Продемонстрирую баг на видео. (0:24, 0:58, 2:35). Помогите разобраться, в чем проблема.
Код:
{$CLEO}
{$NOSOURCE}
{$INCLUDE SF}
thread "TELEPORTER"
const
EVENT_BUTTON_CLICKED                = 257
EVENT_LISTBOX_ITEM_DBLCLK           = 1793

DIALOG_POS_X                        = 250.0
DIALOG_POS_Y                        = 170.0
DIALOG_SIZE_X                       = 370
DIALOG_SIZE_Y                       = 255

LISTBOX_SIZE_X                      = 360
LISTBOX_SIZE_Y                      = 197

end
0000: NOP
repeat
    wait 400
until 0AFA:  is_samp_available

0AF8: samp add_message_to_chat "Используйте команду /atp для вызова меню" color -1
0B34: samp register_client_command "atp" to_label @dialog_main

while true
    wait 0
    if
    0BAB: dialog 0@ is_exists
    then
       0B5D: samp toggle_cursor 1
    
        if 0B81: dialog 0@ pop_event_to 1@ control_id_to 2@
          then
     
        if 1@ == EVENT_BUTTON_CLICKED
          then
         
            if 2@ == 3
            then
                0BA4: dialog 0@ free
                0B5D: samp toggle_cursor 0
            end         
        end
        if 2@ == 1
        then
     
            if 1@ == EVENT_LISTBOX_ITEM_DBLCLK
            then
                0B9B: dialog 0@ listbox 2@ selected_element_to 3@ elements_count_to 4@
           
                  if 3@ == 0
                  then
                        0BA4: dialog 0@ free
                        wait 0
                        0B80: dialog 10@ = create "Общественные места"
                        0B60: convert_game_screen_coords DIALOG_POS_X DIALOG_POS_Y to_window_screen_coords 2@ 3@
                        0B84: dialog 10@ set_pos_XY 2@ 3@ size DIALOG_SIZE_X DIALOG_SIZE_Y
                        0B99: dialog 10@ add_listbox id 1 pos_XY 5 5 size LISTBOX_SIZE_X LISTBOX_SIZE_Y
                        0B9A: dialog 10@ listbox 1 insert_element "Мэрия г. Лос-Сантос" with_data 1 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Мэрия г. Сан-Фиерро" with_data 2 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Мэрия г. Лас-Вентурас" with_data 3 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Больница г. Лос-Сантос" with_data 4 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Больница г. Сан-Фиерро" with_data 5 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Больница г. Лас-Вентурас" with_data 6 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Шахта" with_data 7 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Завод" with_data 8 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Банк г. Лос-Сантос" with_data 9 after -1
                        0B9A: dialog 10@ listbox 1 insert_element "Банк г. Лас-Вентурас" with_data 10 after -1
                        0B82: dialog 10@ add_button id 2 text "Назад" pos_XY 70 204 size 100 30
                        0B82: dialog 10@ add_button id 3 text "Отмена" pos_XY 190 204 size 100 30
                  end  
         
                      if 3@ == 1
                      then
                        0BA4: dialog 0@ free
                        wait 0
                        0B80: dialog 11@ = create "Транспортные узлы"
                        0B60: convert_game_screen_coords DIALOG_POS_X DIALOG_POS_Y to_window_screen_coords 2@ 3@
                        0B84: dialog 11@ set_pos_XY 2@ 3@ size DIALOG_SIZE_X DIALOG_SIZE_Y
                        0B99: dialog 11@ add_listbox id 1 pos_XY 5 5 size LISTBOX_SIZE_X LISTBOX_SIZE_Y
                        0B9A: dialog 11@ listbox 1 insert_element "Автостанция г. Лос-Сантос" with_data 1 after -1
                        0B9A: dialog 11@ listbox 1 insert_element "Ж/Д вокзал г. Лос-Сантос" with_data 2 after -1
                        0B9A: dialog 11@ listbox 1 insert_element "Автостанция г. Сан-Фиерро" with_data 3 after -1
                        0B9A: dialog 11@ listbox 1 insert_element "Автостанция г. Лас-Вентурас" with_data 4 after -1
                        0B82: dialog 11@ add_button id 2 text "Назад" pos_XY 70 204 size 100 30
                        0B82: dialog 11@ add_button id 3 text "Отмена" pos_XY 190 204 size 100 30
                      end
        
                     if 3@ == 2
                     then
                            0BA4: dialog 0@ free
                            wait 0
                            0B80: dialog 12@ = create "Военные объекты"
                            0B60: convert_game_screen_coords DIALOG_POS_X DIALOG_POS_Y to_window_screen_coords 2@ 3@
                            0B84: dialog 12@ set_pos_XY 2@ 3@ size DIALOG_SIZE_X DIALOG_SIZE_Y
                            0B99: dialog 12@ add_listbox id 1 pos_XY 5 5 size LISTBOX_SIZE_X LISTBOX_SIZE_Y
                            0B9A: dialog 12@ listbox 1 insert_element "База СВ" with_data 1 after -1
                            0B9A: dialog 12@ listbox 1 insert_element "База ВВС" with_data 2 after -1
                            0B9A: dialog 12@ listbox 1 insert_element "База ВМФ" with_data 3 after -1
                            0B9A: dialog 12@ listbox 1 insert_element "Министерство Обороны" with_data 4 after -1
                            0B9A: dialog 12@ listbox 1 insert_element "Военкомат" with_data 5 after -1
                            0B9A: dialog 12@ listbox 1 insert_element "Авианосец" with_data 6 after -1
                            0B82: dialog 12@ add_button id 2 text "Назад" pos_XY 70 204 size 100 30
                            0B82: dialog 12@ add_button id 3 text "Отмена" pos_XY 190 204 size 100 30
                     end
         
                     if 3@ == 3
                     then     
                            0BA4: dialog 0@ free
                            wait 0
                            0B80: dialog 13@ = create "Развлечения"
                            0B60: convert_game_screen_coords DIALOG_POS_X DIALOG_POS_Y to_window_screen_coords 2@ 3@
                            0B84: dialog 13@ set_pos_XY 2@ 3@ size DIALOG_SIZE_X DIALOG_SIZE_Y
                            0B99: dialog 13@ add_listbox id 1 pos_XY 5 5 size LISTBOX_SIZE_X LISTBOX_SIZE_Y
                            0B9A: dialog 13@ listbox 1 insert_element "Казино" with_data 1 after -1
                            0B82: dialog 13@ add_button id 2 text "Назад" pos_XY 70 204 size 100 30
                            0B82: dialog 13@ add_button id 3 text "Отмена" pos_XY 190 204 size 100 30
                     end
           end
        end
    end
end
   if 0BAB: dialog 10@ is_exists
   then  

        if 0B81: dialog 10@ pop_event_to 1@ control_id_to 2@
        then
         
             if 1@ == EVENT_BUTTON_CLICKED
          then
         
            if 2@ == 3 // Кнопка "Отмена"
            then
                0BA4: dialog 10@ free
                0B5D: samp toggle_cursor 0
            end         
        end
         
          if 2@ == 1
          then
       
              if 1@ == EVENT_LISTBOX_ITEM_DBLCLK
              then
                0B9B: dialog 10@ listbox 2@ selected_element_to 3@ elements_count_to 4@
                     
                    if 3@ == 0
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        04E4: refresh_game_renderer_at 1479.7820 -1656.2716
                        03CB: set_rendering_origin_at 1479.7820 -1656.2716 14.0469
                        02CE: 2@ = ground_z_at 1479.7820 -1656.2716 10000.0
                        Actor.PutAt($PLAYER_ACTOR, 1479.7820,-1656.2716, 2@)
                        0AF8: samp add_message_to_chat "Вы были телепортированы около Мэрии г. Лос-Сантос" color -1
                    end
                 
                     if 3@ == 1
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        Actor.PutAt($PLAYER_ACTOR, -2706.49,376.27,4.97)
                        0AF8: samp add_message_to_chat "Вы были телепортированы около Мэрии г. Сан-Фиерро" color -1
                    end
                 
                     if 3@ == 2
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        Actor.PutAt($PLAYER_ACTOR, 2359.90,2475.61,10.82)
                        0AF8: samp add_message_to_chat "Вы были телепортированы около Мэрии г. Лас-Вентурас" color -1
                    end
                 
                     if 3@ == 3
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        Actor.PutAt($PLAYER_ACTOR, 1187.59,-1318.83,13.57)
                        0AF8: samp add_message_to_chat "Вы были телепортированы около больницы г. Лос-Сантос" color -1
                    end
                 
                     if 3@ == 4
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        Actor.PutAt($PLAYER_ACTOR, -2644.99,615.35,14.45)
                        0AF8: samp add_message_to_chat "Вы были телепортированы около больницы г. Сан-Фиерро" color -1
                    end
         
                    if 3@ == 5
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        Actor.PutAt($PLAYER_ACTOR, 1603.80,1829.10,10.82)
                        0AF8: samp add_message_to_chat "Вы были телепортированы около больницы г. Лас-Вентурас" color -1
                    end
                 
                    if 3@ == 6
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        Actor.PutAt($PLAYER_ACTOR, -1818.7054,-1620.4059,35.4024)
                        0AF8: samp add_message_to_chat "Вы были телепортированы на шахту" color -1
                    end
                 
                    if 3@ == 7
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        Actor.PutAt($PLAYER_ACTOR, -112.1463,-316.2928,28.8565)
                        0AF8: samp add_message_to_chat "Вы были телепортированы на завод" color -1
                    end
                 
                    if 3@ == 8
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                       // Actor.PutAt($PLAYER_ACTOR, -112.1463,-316.2928,28.8565)
                        0AF8: samp add_message_to_chat "Вы не были телепортированы около банка г. Лос-Сантос. Гы-гы." color -1
                    end
                 
                    if 3@ == 9
                    then
                        0BA4: dialog 10@ free
                        0B5D: samp toggle_cursor 0
                        //Actor.PutAt($PLAYER_ACTOR, -112.1463,-316.2928,28.8565)
                        0AF8: samp add_message_to_chat "Вы не были телепортированы около банка г. Сан-Фиерро." color -1
                    end
                    end
                    end
                    end
                    end
 
     if 0BAB: dialog 11@ is_exists
     then
  
         if 0B81: dialog 11@ pop_event_to 1@ control_id_to 2@
         then
        // 0@ - структура диалога ; 1@ - ид события ; 2@ - ид компонента
                 if 1@ == EVENT_BUTTON_CLICKED
          then
         
            if 2@ == 3 // Кнопка "Отмена"
            then
                0BA4: dialog 11@ free
                0B5D: samp toggle_cursor 0
            end         
        end
     
            if 2@ == 1
            then
     
                 if 1@ == EVENT_LISTBOX_ITEM_DBLCLK
                 then
                      0B9B: dialog 11@ listbox 2@ selected_element_to 3@ elements_count_to 4@
                        
                            if 3@ == 0
                            then
                                0BA4: dialog 11@ free
                                0B5D: samp toggle_cursor 0
                                Actor.PutAt($PLAYER_ACTOR, 1157.38,-1777.41,33.63)
                                0AF8: samp add_message_to_chat "Вы были телепортированы на автостанцию г. Лос-Сантос" color -1
                            end
                         
                            if 3@ == 1
                            then
                                0BA4: dialog 11@ free
                                0B5D: samp toggle_cursor 0
                               // Actor.PutAt($PLAYER_ACTOR, 1157.38,-1777.41,33.63)
                                0AF8: samp add_message_to_chat "Вы не были телепортированы на Ж/Д вокзал г. Лос-Сантос" color -1
                            end
                         
                            if 3@ == 2
                            then
                                0BA4: dialog 11@ free
                                0B5D: samp toggle_cursor 0
                                Actor.PutAt($PLAYER_ACTOR, -1979.37,157.71,39.85)
                                0AF8: samp add_message_to_chat "Вы были телепортированы на автостанцию г. Сан-Фиерро" color -1
                            end
                         
                            if 3@ == 3
                            then
                                0BA4: dialog 11@ free
                                0B5D: samp toggle_cursor 0
                                Actor.PutAt($PLAYER_ACTOR, 2842.95,1303.15,22.74)
                                0AF8: samp add_message_to_chat "Вы были телепортированы на автостанцию г. Лас-Вентурас" color -1
                            end
                            end
                    end
                    end
                    end
                 
    if 0BAB: dialog 12@ is_exists
    then 
 
         if 0B81: dialog 12@ pop_event_to 1@ control_id_to 2@
         then
             
  if 1@ == EVENT_BUTTON_CLICKED
          then
         
            if 2@ == 3 // Кнопка "Отмена"
            then
                0BA4: dialog 12@ free
                0B5D: samp toggle_cursor 0
            end         
        end
                    
        if 2@ == 1
        then
            if 1@ == EVENT_LISTBOX_ITEM_DBLCLK
            then
                0B9B: dialog 12@ listbox 2@ selected_element_to 3@ elements_count_to 4@
        
            if 3@ == 0
            then
                            0BA4: dialog 12@ free
                            0B5D: samp toggle_cursor 0
                            Actor.PutAt($PLAYER_ACTOR, 283.9048,1955.8020,28.4859)
                            0AF8: samp add_message_to_chat "Вы были телепортированы на базу Сухопутных Войск" color -1
                        end
                     
                         if 3@ == 1
                        then
                            0BA4: dialog 12@ free
                            0B5D: samp toggle_cursor 0
                            Actor.PutAt($PLAYER_ACTOR, 404.7473,2472.3250,29.6439)
                            0AF8: samp add_message_to_chat "Вы были телепортированы на базу Военно-Воздушных Сил" color -1
                        end
                     
                         if 3@ == 2
                        then
                            0BA4: dialog 12@ free
                            0B5D: samp toggle_cursor 0
                            Actor.PutAt($PLAYER_ACTOR, -2232.0620,2358.2217,20.6625)
                            0AF8: samp add_message_to_chat "Вы были телепортированы на базу Военно-Морского Флота" color -1
                        end
                     
                         if 3@ == 3
                        then
                            0BA4: dialog 12@ free
                            0B5D: samp toggle_cursor 0
                            Actor.PutAt($PLAYER_ACTOR, 1042.88,1032.48,11.00)
                            0AF8: samp add_message_to_chat "Вы были телепортированы около здания Министерства Обороны" color -1
                        end
                     
                         if 3@ == 4
                        then
                            0BA4: dialog 12@ free
                            0B5D: samp toggle_cursor 0
                            Actor.PutAt($PLAYER_ACTOR, 1051.44,1332.05,10.82)
                            0AF8: samp add_message_to_chat "Вы были телепортированы около военкомата" color -1
                        end
                     
                         if 3@ == 5
                        then
                            0BA4: dialog 12@ free
                            0B5D: samp toggle_cursor 0
                            Actor.PutAt($PLAYER_ACTOR, -1504.1340,436.9721,42.3125)
                            0AF8: samp add_message_to_chat "Вы были телепортированы на авианосец" color -1
                        end
                           end
                    end
                    end
                    end
               
      if 0BAB: dialog 13@ is_exists
    then 
 
         if 0B81: dialog 13@ pop_event_to 1@ control_id_to 2@
         then
        // 0@ - структура диалога ; 1@ - ид события ; 2@ - ид компонента
             
  if 1@ == EVENT_BUTTON_CLICKED
          then
         
            if 2@ == 3 // Кнопка "Отмена"
            then
                0BA4: dialog 13@ free
                0B5D: samp toggle_cursor 0
            end         
        end
                    
        if 2@ == 1
        then
            if 1@ == EVENT_LISTBOX_ITEM_DBLCLK
            then
                0B9B: dialog 13@ listbox 2@ selected_element_to 3@ elements_count_to 4@
                 
            if 3@ == 0
            then
                0BA4: dialog 13@ free
                0B5D: samp toggle_cursor 0
                Actor.PutAt($PLAYER_ACTOR, 2150.74,1678.90,10.82)
                0AF8: samp add_message_to_chat "Вы были телепортированы около казино" color -1
            end
                end
                    end
                    end
                    end                       
end

:dialog_main
wait 0   
0B80: dialog 0@ = create "Teleporter"
0B60: convert_game_screen_coords DIALOG_POS_X DIALOG_POS_Y to_window_screen_coords 2@ 3@
0B84: dialog 0@ set_pos_XY 2@ 3@ size DIALOG_SIZE_X DIALOG_SIZE_Y
0B99: dialog 0@ add_listbox id 1 pos_XY 5 5 size LISTBOX_SIZE_X LISTBOX_SIZE_Y
0B9A: dialog 0@ listbox 1 insert_element "Общественные места" with_data 1 after -1
0B9A: dialog 0@ listbox 1 insert_element "Транспортные узлы" with_data 2 after -1
0B9A: dialog 0@ listbox 1 insert_element "Военные объекты" with_data 3 after -1
0B9A: dialog 0@ listbox 1 insert_element "Развлечения" with_data 4 after -1
0B82: dialog 0@ add_button id 3 text "Отмена" pos_XY 135 204 size 100 30
0B43: samp cmd_ret
 

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,696
1,469
Попробуй обнулять переменные, которые хранили указатели на диалоги(0@, 10@, 11@, 12@, 13@): 0@ = 0, 10@ = 0, ...
 
  • Нравится
Реакции: Garrus

woksonal

Известный
Проверенный
268
154
как получить аим дату другого перса, может знает кто оффсет для 0.3.7?
 

DarkP1xel

Сила воли наше всё.
BH Team
3,637
5,024
как получить аим дату другого перса, может знает кто оффсет для 0.3.7?
Например через hook (ptr)


CLEO:
PACKET_AIM_SYNC

CONST
byteCamMode = 1
vecAimf1 = 2
vecAimf2 = 6
vecAimf3 = 10
vecAimPos1 = 14
vecAimPos2 = 18
vecAimPos3 = 22
fAimZ = 26
byteCamExtZoom = 30
byteWeaponState = 31
bUnk = 32
END