Jump to content

Black Week începe curând. Detalii aici

60% reducere pentru pachetele de 4e si 1e - 300 utilizari - COD: BFRPG60
50% reducere pentru pachetele de 100e - 20 utilizari - COD: BFRPG50
40% reducere pentru pachetele de 50e - 40 utilizari - COD: BFRPG40
30% reducere pentru pachetele de 40e si 30e - 60 utilizari - COD: BFRPG30
25% reducere pentru pachetele de 20e, 15e si 10e - 100 utilizari - COD: BFRPG25
50% reducere la toate produsele pentru forum - 60 utilizari - COD: BFFORUM50

 

Recrutăm designeri audio și video. Aplicați aici

D J C

[CLEO] Lable

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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 by CouldnoT

Share this post


Link to post
Share on other sites

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 by Tupi

Share this post


Link to post
Share on other sites

@Tupi

Yep, both code works well.

Thanks a lot, you can close the topic.

Share this post


Link to post
Share on other sites

With pleasure :D  

 

:topic_closed:

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.