CLEO Help Help with Dialog close.

CLEO related
Status
Not open for further replies.

Zin

Expert
Joined
Aug 1, 2013
Messages
1,692
Reaction score
105
Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP 

repeat
wait 0
until samp.Available()
Dialog.Create(0@, "Zin's NOP Master")
Dialog.SetRECT(0@, 0, 290, 260, 290)
Dialog.AddCheckBox(0@, 1, "SetPos", 0, 0, 200, 40)
Dialog.AddCheckBox(0@, 2, "RemoveFromVeh", 0, 45, 200, 40)
Dialog.AddCheckBox(0@, 3, "EngineState", 0, 90, 200, 40)
Dialog.AddCheckBox(0@, 4, "Vehicle God", 0, 135, 200, 40)
Dialog.AddButton(0@, 5, "Close", 60, 240, 145, 20)
dialog.SetVisible(0@,0)
0B34: samp register_client_command "mcar" to_label @Noname_42
 
:SetPos
0B2E: 1@ = read_samp_memory 0x146e0 size 2
wait 0
if
Dialog.CheckBoxIsChecked(0@, 2)
THEN
    0B2D: write samp_memory 0x146e0 value 0xC390 size 2
    jump @RemovePlayer
ELSE
    0B2E: 30@ = read_samp_memory 0x146e0 size 2
    IF 
    30@ = 0xC390
    jf @RemovePlayer
    0B2D: write samp_memory 0x146e0 value 1@ size 2
    jump @RemovePlayer
END

:RemovePlayer
0B2E: 1@ = read_samp_memory 0x1a4f0 size 2
wait 0
if
Dialog.CheckBoxIsChecked(0@, 1)
THEN
    0B2D: write samp_memory 0x1a4f0 value 0xC390 size 2
    jump @SetPos
ELSE
    0B2E: 30@ = read_samp_memory 0x1a4f0 size 2
    IF 
    30@ = 0xC390
    jf @EngineState
    0B2D: write samp_memory 0x1a4f0 value 1@ size 2
    jump @EngineState
END


:EngineState
wait 0
if and
actor.Driving($PLAYER_ACTOR)
Dialog.CheckBoxIsChecked(0@, 3)
jf @CarGod
31@ = actor.CurrentCar($PLAYER_ACTOR)
0ABF: set_vehicle 31@ engine_state_to 1
jump @CarGod

:CarGod
wait 0
if and
actor.Driving($PLAYER_ACTOR)
Dialog.CheckBoxIsChecked(0@, 4)
jf @CLOSE
31@ = actor.CurrentCar($PLAYER_ACTOR)
car.SetImmunities(31@,1,1,1,1,1)
jump @CLOSE

:CLOSE
0B81: dialog 0@ pop_event_to 2@ control_id_to 3@
if and
3@ == 5 // ID
2@ == 257 // pressed
jf @SetPos
dialog.SetVisible(0@,0)
jump @SetPos

:Noname_42
Dialog.SetVisible(0@, 1)
SAMP.CmdRet()
so I'm making this multi-hack but I'm having a problem where the dialog won't close when I press the close button, so basically if I tick the box for "SetPos" the dialog won't close with the button and will only close once that checkbox is untchecked so I can press the close button nothing will happen till the "SetPos" checkbox is not checked.
 

WaTTi

Well-known member
Joined
Jan 4, 2015
Messages
260
Reaction score
8
:CLOSE
0B81: dialog 0@ pop_event_to -1 control_id_to 3@
if
3@ == 5 // ID
jf @SetPos
dialog.SetVisible(0@,0)
jump @SetPos
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,692
Reaction score
105
Opcode.eXe said:
I would be able to help you if you only used
IF
THEN
END
WHILE TRUE
REPEAT
UNTIL
blabla but no u decide to use :JUMP ASLBABLAL @else jump

Except when I do that it makes the script not work at all.

Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP 

repeat
wait 0
until samp.Available()
Dialog.Create(0@, "Zin's NOP Master")
Dialog.SetRECT(0@, 0, 290, 260, 290)
Dialog.AddCheckBox(0@, 1, "SetPos", 0, 0, 200, 40)
Dialog.AddCheckBox(0@, 2, "RemoveFromVeh", 0, 45, 200, 40)
Dialog.AddCheckBox(0@, 3, "EngineState", 0, 90, 200, 40)
Dialog.AddCheckBox(0@, 4, "Vehicle God", 0, 135, 200, 40)
Dialog.AddButton(0@, 5, "Close", 60, 240, 145, 20)
dialog.SetVisible(0@,0)
0B34: samp register_client_command "mcar" to_label @Noname_42
0B2E: 5@ = read_samp_memory 0x15970 size 2
0B2E: 6@ = read_samp_memory 0x146e0 size 2


 
:MAIN
IF
    dialog.CheckBoxIsChecked(0@,1)
THEN
    0B2E: 1@ = read_samp_memory 0x15970 size 2
    IF
        1@ == 0xC390
    THEN
        //nothing
    ELSE
        0B2D: write samp_memory 0x15970 value 0xC390 size 2
    END    
ELSE
    0B2E: 1@ = read_samp_memory 0x15970 size 2
    IF
        1@ == 0xC390
    THEN
        0B2D: write samp_memory 0x15970 value 5@ size 2
    ELSE
        //nothing
    END
END

IF
    dialog.CheckBoxIsChecked(0@,2)
THEN
    0B2E: 1@ = read_samp_memory 0x146e0 size 2
    IF
        1@ == 0xC390
    THEN
        //nothing
    ELSE
        0B2D: write samp_memory 0x146e0 value 0xC390 size 2
    END    
ELSE
    0B2E: 1@ = read_samp_memory 0x146e0 size 2
    IF
        1@ == 0xC390
    THEN
        0B2D: write samp_memory 0x146e0 value 5@ size 2
    ELSE
        //nothing
    END
END

IF AND
    actor.Driving($PLAYER_ACTOR)
    dialog.CheckBoxIsChecked(0@,3)
THEN
    31@ = actor.CurrentCar($PLAYER_ACTOR)
    0ABF: set_vehicle 31@ engine_state_to 1
ELSE
    //nothing
END

IF
    dialog.CheckBoxIsChecked(0@,4)
THEN
    IF
        actor.Driving($PLAYER_ACTOR)
    THEN
        31@ = actor.CurrentCar($PLAYER_ACTOR)
        car.SetImmunities(31@,1,1,1,1,1)
    ELSE
        //nothing
    END
ELSE
    0B81: dialog 0@ pop_event_to 2@ control_id_to 3@
    IF AND
        3@ == 5 // ID
        2@ == 257 // pressed
    THEN
        dialog.SetVisible(0@,0)
    ELSE
        jump @MAIN
    END
END
    
:Noname_42
Dialog.SetVisible(0@, 1)
SAMP.CmdRet()
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
If script doesn't work when you use the high level syntax, it means something is wrong in your code
And it's also easy to help a guy correct his mistake in a high level code rather than low, like come on, aint nobody got time to read macaroni code, ASM time is passed by long times ago
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,692
Reaction score
105
Got it to work in the high level syntax but I'm still getting that issue with the "CLOSE" button.
 

_=Gigant=_

Well-known member
Joined
Mar 21, 2017
Messages
353
Reaction score
16
Zin said:
Got it to work in the high level syntax but I'm still getting that issue with the "CLOSE" button.

u can try with cmd like 

0B34: samp register_client_command ".dialogON" to_label @DialogVisible     
0B34: samp register_client_command ".dialogOFF" to_label @DialogInvisible     :eek:mgrun:

and also add 

:DialogInvisible
/// maybe here u add some wait u know ....
0B86: dialog <here label shit for Dialog or menu whatever... like 1@ or 2@ > set_visible 0 

:DialogVisible
/// also here maybe some wait  ....
0B86:  dialog 2@ set_visible 1 // bla bla bla

then 

0B80: dialog 2@ = create "{269BD8}Zin will merry me soon {FFFFFF}First try "  // these {FFFFF} are for color u know ....

0B84: dialog 2@ set_pos_XY 500 200 size 440 210   /* 400 width  200 height bla bla bla */
//and under this u add some text and checkbox whatever

0B91: dialog 2@ add_static id 1 text "{FFFFFF}Opcode.eXe invited" pos_XY 50 55 size 250 20
0B91: dialog 2@ add_static id 2 text "{FFFFFF}supahdupahnubah invited" pos_XY 50 75 size 250 20
0B91: dialog 2@ add_static id 3 text "{FFFFFF}springfield invited " pos_XY 50 95 size 250 20
0B91: dialog 2@ add_static id 4 text "{FFFFFF}and all other cute girls from ug base" pos_XY 50 115 size 250 20

// u go for pos XY for 25 up on second number like if on first 50 55 on second will be 50 75 u can keep it on same position also ... lel

and dont forget samp cmd_ret or free crash like ....

0B43: samp cmd_ret

i eat buttons so idk for them XXX  e.e
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,131
Solutions
5
Reaction score
884
Location
Lithuania
Zin said:
Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.201
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP 

repeat
wait 0
until samp.Available()
Dialog.Create(0@, "Zin's NOP Master")
Dialog.SetRECT(0@, 0, 290, 260, 290)
Dialog.AddCheckBox(0@, 1, "SetPos", 0, 0, 200, 40)
Dialog.AddCheckBox(0@, 2, "RemoveFromVeh", 0, 45, 200, 40)
Dialog.AddCheckBox(0@, 3, "EngineState", 0, 90, 200, 40)
Dialog.AddCheckBox(0@, 4, "Vehicle God", 0, 135, 200, 40)
Dialog.AddButton(0@, 5, "Close", 60, 240, 145, 20)
dialog.SetVisible(0@,0)
0B34: samp register_client_command "mcar" to_label @Noname_42
 
:SetPos
0B2E: 1@ = read_samp_memory 0x146e0 size 2
wait 0
if
Dialog.CheckBoxIsChecked(0@, 2)
THEN
    0B2D: write samp_memory 0x146e0 value 0xC390 size 2
    jump @RemovePlayer
ELSE
    0B2E: 30@ = read_samp_memory 0x146e0 size 2
    IF 
    30@ = 0xC390
    jf @RemovePlayer
    0B2D: write samp_memory 0x146e0 value 1@ size 2
    jump @RemovePlayer
END

:RemovePlayer
0B2E: 1@ = read_samp_memory 0x1a4f0 size 2
wait 0
if
Dialog.CheckBoxIsChecked(0@, 1)
THEN
    0B2D: write samp_memory 0x1a4f0 value 0xC390 size 2
    jump @SetPos
ELSE
    0B2E: 30@ = read_samp_memory 0x1a4f0 size 2
    IF 
    30@ = 0xC390
    jf @EngineState
    0B2D: write samp_memory 0x1a4f0 value 1@ size 2
    jump @EngineState
END


:EngineState
wait 0
if and
actor.Driving($PLAYER_ACTOR)
Dialog.CheckBoxIsChecked(0@, 3)
jf @CarGod
31@ = actor.CurrentCar($PLAYER_ACTOR)
0ABF: set_vehicle 31@ engine_state_to 1
jump @CarGod

:CarGod
wait 0
if and
actor.Driving($PLAYER_ACTOR)
Dialog.CheckBoxIsChecked(0@, 4)
jf @CLOSE
31@ = actor.CurrentCar($PLAYER_ACTOR)
car.SetImmunities(31@,1,1,1,1,1)
jump @CLOSE

:CLOSE
0B81: dialog 0@ pop_event_to 2@ control_id_to 3@
if and
3@ == 5 // ID
2@ == 257 // pressed
jf @SetPos
dialog.SetVisible(0@,0)
jump @SetPos

:Noname_42
Dialog.SetVisible(0@, 1)
SAMP.CmdRet()
so I'm making this multi-hack but I'm having a problem where the dialog won't close when I press the close button, so basically if I tick the box for "SetPos" the dialog won't close with the button and will only close once that checkbox is untchecked so I can press the close button nothing will happen till the "SetPos" checkbox is not checked.

Look !
[shcode=cpp]
{$CLEO .cs}


//-------------MAIN---------------
0000: NOP

REPEAT
wait 0
UNTIL samp.Available()

Dialog.Create(0@, "Zin's NOP Master")
Dialog.SetRECT(0@, 0, 290, 260, 290)
Dialog.AddCheckBox(0@, 1, "SetPos", 0, 0, 200, 40)
Dialog.AddCheckBox(0@, 2, "RemoveFromVeh", 0, 45, 200, 40)
Dialog.AddCheckBox(0@, 3, "EngineState", 0, 90, 200, 40)
Dialog.AddCheckBox(0@, 4, "Vehicle God", 0, 135, 200, 40)
Dialog.AddButton(0@, 5, "Close", 60, 240, 145, 20)
dialog.SetVisible(0@,0)

0B34: samp register_client_command "mcar" to_label @ShowDialog
0B2E: 5@ = read_samp_memory 0x15970 size 2
0B2E: 6@ = read_samp_memory 0x146e0 size 2



WHILE TRUE
wait 0

IF
Dialog.IsVisible(0@)
THEN
    SAMP.ToggleCursor(1)
    
///////////////////////////////////////////
/////////// Here all your code ///////////
///////////////////////////////////////////

IF
0B81: dialog 0@ pop_event_to 2@ control_id_to 3@
THEN
    IF AND
    3@ == 5 // ID
    2@ == 257 // pressed
    THEN
        Dialog.SetVisible(0@,0)
        SAMP.ToggleCursor(0)
   ELSE
       //nothing
    END
END

END // END Dialog.IsVisible(0@)
END /// END WHILE TRUE
   
:ShowDialog
Dialog.SetVisible(0@, 1)

0B43: samp cmd_ret
[/shcode]

Good luck !
@Zin
 
Status
Not open for further replies.
Top