D J C Posted November 19, 2020 Share Posted November 19, 2020 Hello. I hope you are healthy. Recently I wrote a code that a part of that code does not work well and is disrupted in the mod Here is all the code: {$CLEO} thread "Service" repeat wait 0 until SAMP.Available() 0B63: "servicee" 0B34: "servicee" @Service WHILE TRUE WAIT 0 if 0B3C: samp is_dialog_responded id 1000 button 2@ list_item $item input_text 0 then if 0AB0: is_key_pressed 27 then 0B47: samp close_current_dialog_with_button 1@ else if 0039: 2@ == 1 then if $item == 0 then 0B3B: samp show_dialog id 1001 caption "Confirm" text "Do you agree to we continue !?" button_1 "Confirm" button_2 "Exit" style 0 $Servicee_item = 2 end if $item == 1 then 0B3B: samp show_dialog id 1001 caption "Confirm" text "Do you agree to we continue !?" button_1 "Confirm" button_2 "Exit" style 0 $Servicee_item = 3 end if $item == 2 then 0B3B: samp show_dialog id 1001 caption "Confirm" text "Do you agree to we continue !?" button_1 "Confirm" button_2 "Exit" style 0 $Servicee_item = 4 end end end end if 0B3C: samp is_dialog_responded id 1001 button 2@ list_item 0 input_text 0 then if 0AB0: is_key_pressed 27 then 0B47: samp close_current_dialog_with_button 1@ else if 0039: 2@ == 1 then if $Servicee_item == 2 then say "First works well." end if $Servicee_item == 3 then say "Second works well." end if $Servicee_item == 4 then say "Third works well." end end end end END :Service 0AC6: 31@ = label @Service_list offset 0B3B: samp show_dialog id 1000 caption "Menu" text 31@ button_1 "Call" button_2 "Exit" style 2 SAMP.CmdRet() :Service_list hex "First"A "Seound"A "Third"00 end ret 0 The main problem is here: if 0B3C: samp is_dialog_responded id 1001 button 2@ list_item 0 input_text 0 then if 0AB0: is_key_pressed 27 then 0B47: samp close_current_dialog_with_button 1@ else if 0039: 2@ == 1 then if $Servicee_item == 2 then say "First works well." end if $Servicee_item == 3 then say "Second works well." end if $Servicee_item == 4 then say "Third works well." end No message will be sent when I confirm this option 0B3B: samp show_dialog id 1001 caption "Confirm" text "Do you agree to we continue !?" button_1 "Confirm" button_2 "Exit" style 0 What do you think could be the problem? You also have a solution? Link to comment Share on other sites More sharing options...
CouldnoT Posted November 19, 2020 Share Posted November 19, 2020 (edited) Hello @D J C, 1. What do you mean by this opcode? I couldn't find such a thing in any documentary. else if 0039: 2@ == 1 This should work {$CLEO} thread "Service" repeat wait 0 until SAMP.Available() 0B63: "servicee" 0B34: "servicee" @Service WHILE TRUE WAIT 0 if 0B3C: samp is_dialog_responded id 1000 button 2@ list_item 3@ input_text 0 then if 0AB0: is_key_pressed 27 then 0B47: samp close_current_dialog_with_button 1@ else if and 3@ == 0 2@ == 1 then 0B3B: samp show_dialog id 1001 caption "Confirm" text "Do you agree to continue ?" button_1 "Confirm" button_2 "Exit" style 0 4@ = 2 end if and 3@ == 1 2@ == 1 then 0B3B: samp show_dialog id 1001 caption "Confirm" text "Do you agree to continue ?" button_1 "Confirm" button_2 "Exit" style 0 4@ = 3 end if and 3@ == 2 2@ == 1 then 0B3B: samp show_dialog id 1001 caption "Confirm" text "Do you agree to continue ?" button_1 "Confirm" button_2 "Exit" style 0 4@ = 4 end end end if 0B3C: samp is_dialog_responded id 1001 button 2@ list_item 0 input_text 0 then if 0AB0: is_key_pressed 27 then 0B47: samp close_current_dialog_with_button 1@ else if and 2@ == 1 4@ == 2 then say "First works well." end if and 2@ == 1 4@ == 3 then say "Second works well." end if and 4@ == 4 2@ == 1 then say "Third works well." end end end END :Service 0AC6: 31@ = label @Service_list offset 0B3B: samp show_dialog id 1000 caption "Menu" text 31@ button_1 "Call" button_2 "Exit" style 2 SAMP.CmdRet() :Service_list hex "First" A "Second" A "Third" 0 end ret 0 I have replaced all your $var with a normal int@ variable, because they will mess up with other mods having the same variable name. And corrected your conditional structures syntax, because you did close the WHILE loop at the first if structure. Make sure you understand the algorithm well. Edited November 19, 2020 by CouldnoT 1 Link to comment Share on other sites More sharing options...
Tupi Posted November 20, 2020 Share Posted November 20, 2020 (edited) Hello, Try this: if 0B3C: samp is_dialog_responded id 1000 button $BUTTON_ID list_item $LIST_ITEM input_text 0 then if 0AB0: is_key_pressed 0x1B (Key ESC) then 0B47: samp close_current_dialog_with_button 33@ else if 0039: $button_id == 1 then if LIST_ITEM == 1 then ... some code end if LIST_ITEM == 2 then ... some code end if LIST_ITEM == 3 then ... some code end else samp close_current_dialog_with_button 33@ end end end @D J C solved ? Edited November 20, 2020 by Tupi 1 Link to comment Share on other sites More sharing options...
D J C Posted November 20, 2020 Author Share Posted November 20, 2020 @Tupi Yep, both code works well. Thanks a lot, you can close the topic. Link to comment Share on other sites More sharing options...
Tupi Posted November 20, 2020 Share Posted November 20, 2020 With pleasure Link to comment Share on other sites More sharing options...
Recommended Posts