CLEO Help DialogBox

CLEO related
Status
Not open for further replies.

CristianSS

Active member
Joined
Jul 24, 2017
Messages
27
Reaction score
0
Hello, i want to create a dialog box, like poolrender, if you know the mod. When you tipe /rend a dialog opens and you have there some options. I know how to create that dialogbox but i don`t know how to create the options!
 

_=Gigant=_

Well-known member
Joined
Mar 21, 2017
Messages
353
Reaction score
16
CristianSS said:
I know how to create that dialogbox but i don`t know how to create the options!
what "options" you want buttons to dialog or commands to be displayed in dialog menu or both ?
maybe this help you 

so cmds

Code:
0B34: samp register_client_command "/opend" to_label @Show //open dialog when cmd is entered
0B34: samp register_client_command "/closed" to_label @Close //close dialog when cmd is entered

:Show
0B86: dialog 1@ set_visible 1
cmdret

:Close
0B86: dialog 1@ set_visible 0 //1@ is your dialog indetification
cmdret
Code:
//////////////////Other options into dialog/////////////////////

0B80: opcode for button to add into dialog
0B82: dialog 1@ add_button id 1 text "{FFFFFF}My Name" pos_XY 15 65 size 50 20

0B83: opcode for checkbox to add into dialog 
0B83: dialog 1@ add_checkbox id 1 text "{FF0F0F} My Name" pos_XY 15 5 size 225 20 //checkbox

0B91: opcode to add text to dialog like 
0B91: dialog 1@ add_static id 1 text "{FFFFFF} Happy New Year - 2018" pos_XY 15 5 size 100 20

or 

0B91: dialog 1@ add_static id 2 text "{FFFFFF} Type //opend -> open dialog" pos_XY 15 5 size 100 20

0B91: dialog 1@ add_static id 2 text "{FFFFFF} Type //closed -> close dialog" pos_XY 15 25 size 100 20

add buttons, text, checkbox to dialog like this

Code:
//////////////////////////////////
0B80: dialog 1@ = create "Dialog"
0B6D: render 0@ = create_font "Bauhaus 93" height 30 flags 0x20
0B84: dialog 1@ set_pos_XY 564 170 /*140*/ size 100 100
0B82: dialog 1@ add_button id 1 text "{FFFFFF}Button 1" pos_XY 15 5 size 50 20
0B82: dialog 1@ add_button id 2 text "{FFFFFF}Button 2" pos_XY 15 25 size 50 20
0B82: dialog 1@ add_button id 3 text "{FFFFFF}Button 3" pos_XY 15 45 size 50 20
0B82: dialog 1@ add_button id 4 text "{FFFFFF}My Name" pos_XY 15 65 size 50 20
0B82: dialog 1@ add_button id 5 text "{FFFFFF}Close Dialog" pos_XY 15 85 size 10 20 

0B83: dialog 1@ add_checkbox id 6 text "{FFFFFF} My Name" pos_XY 15 105 size 225 20 //checkbox

0B91: dialog 1@ add_static id 7 text "{FFFFFF} Happy New Year - 2018" pos_XY 15 125 size 100 20
0B91: dialog 1@ add_static id 8 text "{FFFFFF} Type //opend -> open dialog" pos_XY 15 145 size 100 20
0B91: dialog 1@ add_static id 9 text "{FFFFFF} Type //closed -> close dialog" pos_XY 15 165 size 100 20

0B86: dialog 1@ set_visible 0 // we set it to off when game starts so it can be displayed only when key is press or cmd ->
//entered <-

repeat
wait 0
if 0B87:  dialog 1@ is_visible
then
0B5D: samp toggle_cursor true
if 0B81: dialog 1@ pop_event_to 3@ control_id_to 4@
then

if 4@ == 1
then
//here code for button
end

if 4@ == 2
then
//here code for button
end

if 4@ == 3
then
//here code for button
end

if 4@ == 4
then
0B2B: samp 10@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B36: samp 11@ = get_player_nickname 10@
say "hi %s" 11@
end

if 4@ == 5
then
//here code for button
0B86: dialog 1@ set_visible 0
0B5D: samp toggle_cursor false
end

end
end


give function to checkbox
Code:
///////////////////////////FOR CHECKBOX///////////////////////

if 0B92:  dialog 1@ checkbox 5 is_checked
then 0AB1: call_scm_func @CheckBoxID1 0
end


:CheckBoxID1
wait 0
IF
0AB0: 88 //X //the message will be displayed when x key is pressed to avoid non stop spam
then
0B2B: samp 10@ = get_player_id_by_actor_handle $PLAYER_ACTOR
0B36: samp 11@ = get_player_nickname 10@
say "hi %s" 11@
end
ret 0
 
Status
Not open for further replies.
Top