Menus work by buttons.
First you need to setup the column with:
Then create the menus contents with 08DB:
Then activate the panel with 090E:
The up/down function is automatically to the up/down arrow keys.
Check in following loop key press and if key is pressed, get the value of the active button place:
"DUMMY" is nothing. The max number for entry's in one panel is 12(0xC) if you do not need to
use up all of them, you can mark them as dummy's.
When the menu is not needed anymore remove it:
Here is a example script, showing how the menu works. Look into the script:
The menus data entry's must be what an entry of a text, in GXT or a *.fxt file. If there is no entry, found with that name, then no texts in the menu will appear. Put DUMMY if the data column is unused ^ <see above>
So basically, if you wanna add other to that menu, for example, after the last menu entry(SULTAN replace DUMMY after that with you're text entry, then go down to:
Change @Remove_Menu with you're next(for example @Menu_10).
So it goes on to the text menu entry.
After the last entry add this for example:
Replace <model> with the model name/ID.
First you need to setup the column with:
- Code:
08D4: 4@ = create_panel_with_title 'DUMMY' position 340.0 120.0 width 240.0 columns 1 interactive 1 background 1 alignment 0
Then create the menus contents with 08DB:
- Code:
08DB: set_panel 4@ column 0 header 'DUMMY' data 'INFERNU' 'BULLET' 'TURISMO' 'CHEETAH' 'SULTAN' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
Then activate the panel with 090E:
- Code:
090E: set_panel 4@ active_row 0
The up/down function is automatically to the up/down arrow keys.
Check in following loop key press and if key is pressed, get the value of the active button place:
- Code:
08D7: 5@ = panel 4@ active_row
"DUMMY" is nothing. The max number for entry's in one panel is 12(0xC) if you do not need to
use up all of them, you can mark them as dummy's.
When the menu is not needed anymore remove it:
- Code:
08DA: remove_panel 4@
Here is a example script, showing how the menu works. Look into the script:
- Code:
{$CLEO .cs}
0000: // Type "TEST" like a cheat, to call the menu
:Menu_01
0001: wait 0 ms
0006: 30@ = -0x38214
00D6: if
0038: &0(30@,1i) == 0x54455354
004D: jump_if_false @Menu_01
0004: &0(30@,1i) = 0x54455300
03E5: show_text_box 'CHEAT1' // Cheat activated
0343: set_text_draw_linewidth 680.0
033E: set_draw_text_position 36.0 20.0 GXT 'TATTA'
01B4: set_player $PLAYER_CHAR can_move 0
03BF: set_player $PLAYER_CHAR ignored_by_everyone 1
0826: enable_hud 0
08D4: 4@ = create_panel_with_title 'DUMMY' position 340.0 120.0 width 240.0 columns 1 interactive 1 background 1 alignment 0
08DB: set_panel 4@ column 0 header 'DUMMY' data 'INFERNU' 'BULLET' 'TURISMO' 'CHEETAH' 'SULTAN' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'
090E: set_panel 4@ active_row 0
04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 8.0 0.0
:Menu_02
0001: wait 0 ms
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @Remove_Menu
00D6: if
00E1: player 0 pressed_key 15
004D: jump_if_false @Menu_03
0002: jump @Remove_Menu
:Menu_03
0001: wait 0 ms
00D6: if
00E1: player 0 pressed_key 16
004D: jump_if_false @Menu_02
08D7: 5@ = panel 4@ active_row
0008: 5@ += 1
:Menu_05
00D6: if
0039: 5@ == 1
004D: jump_if_false @Menu_06
0247: load_model #INFERNUS
while 8248: not model #INFERNUS available
0001: wait 0 ms
end
00A5: 0@ = create_car #INFERNUS at 1@ 2@ 3@
0249: release_model #INFERNUS
01C3: remove_references_to_car 0@ // Like turning a car into any random car
0002: jump @Remove_Menu
:Menu_06
00D6: if
0039: 5@ == 2
004D: jump_if_false @Menu_07
0247: load_model #BULLET
while 8248: not model #BULLET available
0001: wait 0 ms
end
00A5: 0@ = create_car #BULLET at 1@ 2@ 3@
0249: release_model #BULLET
01C3: remove_references_to_car 0@ // Like turning a car into any random car
0002: jump @Remove_Menu
:Menu_07
00D6: if
0039: 5@ == 3
004D: jump_if_false @Menu_08
0247: load_model #TURISMO
while 8248: not model #TURISMO available
0001: wait 0 ms
end
00A5: 0@ = create_car #TURISMO at 1@ 2@ 3@
0249: release_model #TURISMO
01C3: remove_references_to_car 0@ // Like turning a car into any random car
0002: jump @Remove_Menu
:Menu_08
00D6: if
0039: 5@ == 4
004D: jump_if_false @Menu_09
0247: load_model #CHEETAH
while 8248: not model #CHEETAH available
0001: wait 0 ms
end
00A5: 0@ = create_car #CHEETAH at 1@ 2@ 3@
0249: release_model #CHEETAH
01C3: remove_references_to_car 0@ // Like turning a car into any random car
0002: jump @Remove_Menu
:Menu_09
00D6: if
0039: 5@ == 5
004D: jump_if_false @Remove_Menu
0247: load_model #SULTAN
while 8248: not model #SULTAN available
0001: wait 0 ms
end
00A5: 0@ = create_car #SULTAN at 1@ 2@ 3@
0249: release_model #SULTAN
01C3: remove_references_to_car 0@ // Like turning a car into any random car
:Remove_Menu
03E6: remove_text_box
01B4: set_player $PLAYER_CHAR can_move 1
03BF: set_player $PLAYER_CHAR ignored_by_everyone 0
08DA: remove_panel 4@
0826: enable_hud 1
03F0: enable_text_draw 0
0002: jump @Menu_01
The menus data entry's must be what an entry of a text, in GXT or a *.fxt file. If there is no entry, found with that name, then no texts in the menu will appear. Put DUMMY if the data column is unused ^ <see above>
So basically, if you wanna add other to that menu, for example, after the last menu entry(SULTAN replace DUMMY after that with you're text entry, then go down to:
- Code:
00D6: if
0039: 5@ == 5
004D: jump_if_false @Remove_Menu
Change @Remove_Menu with you're next(for example @Menu_10).
So it goes on to the text menu entry.
After the last entry add this for example:
- Code:
:Menu_10 // same as
00D6: if
0039: 5@ == 6
004D: jump_if_false @Remove_Menu
0247: load_model <model>
while 8248: not model <model> available
0001: wait 0 ms
end
00A5: 0@ = create_car <model> at 1@ 2@ 3@
0249: release_model <model>
01C3: remove_references_to_car 0@ // Like turning a car into any random car
Replace <model> with the model name/ID.