Skip to content

Instantly share code, notes, and snippets.

@Tustin
Created April 16, 2017 03:42
Show Gist options
  • Save Tustin/b4ad4692a94c7e732a1a547476542adf to your computer and use it in GitHub Desktop.
Save Tustin/b4ad4692a94c7e732a1a547476542adf to your computer and use it in GitHub Desktop.
//Compiled using RAGE-C by Tustin 4/15/2017
:__script_entry__
Function 0 2 0
//Auto assigning 13 statics
push_0
StaticSet1 1 //Menus_MAIN_MENU
push_1
StaticSet1 2 //Menus_PLAYER_MENU
push_2
StaticSet1 3 //Menus_VEHICLE_MENU
push_3
StaticSet1 4 //Menus_WEAPON_MENU
push_4
StaticSet1 5 //Menus_WORLD_MENU
push_0
StaticSet1 6 //PlayerMenu_GODMODE
push_1
StaticSet1 7 //PlayerMenu_INFINITE_AMMO
push_0
StaticSet1 8 //currentMenu
push_0
StaticSet1 9 //currentOption
push_0
StaticSet1 10 //open
StaticSet1 11 //currentMenuHeight
push_0
StaticSet1 12 //lastButtonPress
push1 200
StaticSet1 13 //buttonPressDelay
Call @main
Return 0 0
:draw_text
Function 5 7 0
getF1 1 //font
CallNative SET_TEXT_FONT 1 0
getF1 4 //size
getF1 4 //size
CallNative SET_TEXT_SCALE 2 0
push1 255
push1 255
push1 255
push1 255
CallNative SET_TEXT_COLOUR 4 0
CallNative SET_TEXT_OUTLINE 0 0
PushString "STRING"
CallNative BEGIN_TEXT_COMMAND_DISPLAY_TEXT 1 0
getF1 0 //text
CallNative ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME 1 0
getF1 2 //x
getF1 3 //y
CallNative END_TEXT_COMMAND_DISPLAY_TEXT 2 0
Return 5 0
:show_notification
Function 1 3 0
PushString "STRING"
CallNative BEGIN_TEXT_COMMAND_PRINT 1 0
getF1 0 //message
CallNative ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME 1 0
pushS 2000
push_1
CallNative END_TEXT_COMMAND_PRINT 2 0
Return 1 0
:draw_menu_title
Function 1 3 0
getF1 0 //title
push_1
fpush 0.839844
fpush 0.191832
fpush 1.05
Call @draw_text
Return 1 0
:draw_background
Function 1 4 0
getF1 0 //items
ItoF
fpush 0.026094
Mult
setF1 3 //tmpHeight
getF1 3 //tmpHeight
fpush 0.030943
Mult
setF1 3 //tmpHeight
fpush 0.840576
fpush 0.248187
getF1 3 //tmpHeight
Add
fpush 0.249766
getF1 3 //tmpHeight
push_0
push_0
push_0
push1 60
CallNative DRAW_RECT 8 0
Return 1 0
:draw_menu
Function 0 3 0
PushString "Goy Menu"
Call @draw_menu_title
push_0
setF1 3 //menuItems
StaticGet1 8 //currentMenu
Switch [0=@selection_0_case_0][1=@selection_0_case_1]
Jump @switch_end_0
:selection_0_case_0
push_4
setF1 3 //menuItems
Jump @switch_end_0
:selection_0_case_1
push_2
setF1 3 //menuItems
Jump @switch_end_0
:switch_end_0
getF1 3 //menuItems
Call @draw_background
Return 0 0
:delayed_key_press
Function 1 3 0
CallNative GET_GAME_TIMER 0 1
StaticGet1 12 //lastButtonPress
Sub
StaticGet1 13 //buttonPressDelay
JumpGT @selection_end_1
push_0
Return 1 1
Jump @selection_end_1
:selection_end_1
push_2
getF1 0 //control
CallNative IS_DISABLED_CONTROL_PRESSED 2 1
JumpFalse @selection_end_2
CallNative GET_GAME_TIMER 0 1
StaticSet1 12 //lastButtonPress
push_1
Return 1 1
Jump @selection_end_2
:selection_end_2
push_0
Return 1 1
:handle_input
Function 0 2 0
push1 203
Call @delayed_key_press
push_1
JumpNE @selection_else_3
PushString "pressed down"
Call @show_notification
StaticGet1 9 //currentOption
Add1 1
StaticSet1 9 //currentOption
StaticGet1 8 //currentMenu
Switch [0=@selection_4_case_0]
Jump @switch_end_4
:selection_4_case_0
StaticGet1 9 //currentOption
push_3
JumpNE @selection_end_5
push_0
StaticSet1 9 //currentOption
Jump @selection_end_5
:selection_end_5
Jump @switch_end_4
:switch_end_4
Jump @selection_end_3
:selection_else_3
push1 204
Call @delayed_key_press
push_1
JumpNE @selection_else_6
PushString "pressed left"
Call @show_notification
Jump @selection_end_6
:selection_else_6
push1 195
Call @delayed_key_press
push_1
JumpNE @selection_end_7
push_0
StaticSet1 10 //open
PushString "closed"
Call @show_notification
Jump @selection_end_7
:selection_end_7
Jump @selection_end_6
:selection_end_6
Jump @selection_end_3
:selection_end_3
Return 0 0
:main
Function 0 2 0
:loop_0
StaticGet1 10 //open
Not
JumpFalse @selection_else_8
push_2
push1 204
CallNative IS_DISABLED_CONTROL_PRESSED 2 1
push_2
push1 201
CallNative IS_DISABLED_CONTROL_PRESSED 2 1
And
JumpFalse @selection_end_9
push_1
StaticSet1 10 //open
push_0
StaticSet1 8 //currentMenu
push_0
StaticSet1 9 //currentOption
CallNative GET_GAME_TIMER 0 1
StaticSet1 12 //lastButtonPress
PushString "menu opened"
Call @show_notification
Jump @selection_end_9
:selection_end_9
Jump @selection_end_8
:selection_else_8
Call @draw_menu
Call @handle_input
Jump @selection_end_8
:selection_end_8
push_0
CallNative wait 1 0
Jump @loop_0
Return 0 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment