Chr0m3 x MoDz
From the top to the fall, lessons through it all.
VIP
Ok guys so this morning I have been helping Duck and I came up with this it's very simple something beginners can actually learn off.
The way this menu works if you press back on your controller and it will say menu activated then you press dpad right and it will scroll through your options then you press a on the option you want once done press back again to close the menu.
Function and Function_1 are where you would put your code then you would go down to the menu_fun function and change the prints to what your mods are.
Now to add on to this you would just do this for example
you would add this
then you would go down to menu_fun and do this
change
to
and then add this under
then you will go in to the button function and add this
The final code will look like this after you have added a option
The way this menu works if you press back on your controller and it will say menu activated then you press dpad right and it will scroll through your options then you press a on the option you want once done press back again to close the menu.
Code:
#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>
#define SELECT 0xD
#define START 0xC
#define SQUARE 0xE
#define TRIANGLE 0xF
#define X 0x10
#define CIRCLE 0x11
#define DPAD_UP 0x8
#define DPAD_DOWN 0x9
#define DPAD_LEFT 0xA
#define DPAD_RIGHT 0xB
#define L2 0x5
#define R2 0x7
#define L1 0x4
#define R1 0x6
#define STICK_L 0x12
#define STICK_R 0x13
int menu=0;
int select=0;
int active=0;
// Base made by Chr0m3 x MoDz
void Print(char *string) /// Print function
{
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", string, 5000, 1);
}
void function(void)
{
/// Mod 1
Print("Menu Slot 1 Activated");
}
void function_1(void)
{
/// Mod 2
Print("Menu Slot 2 Activated");
}
void menu_check(void)
{
if (IS_BUTTON_JUST_PRESSED(0, SELECT)) // button press anything in { and } will happen when you press select
{
if (menu == 0)
{
Print("Menu Activated");
menu=1;
}
else if (menu == 1)
{
menu=0;
Print("Menu Disabled");
}
}
}
void menu_fun(void)
{
if (menu == 1)
{
if (IS_BUTTON_JUST_PRESSED(0, DPAD_RIGHT))
{
if (select == 0)
{
Print("Menu Slot 1");
select=1;
active=1;
}
else if (select == 1)
{
Print("Menu Slot 2");
select=0;
active=2;
}
}
}
}
void button(void)
{
if (menu == 1)
{
if (IS_BUTTON_JUST_PRESSED(0, X))
{
if (active == 1)
{
function();
}
else if (active == 2)
{
function_1();
}
}
}
}
void main(void)
{
THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
Print("Chr0m3 x MoDz");
while(true)
{
button();
menu_fun();
menu_check();
WAIT(0);
}
}
Function and Function_1 are where you would put your code then you would go down to the menu_fun function and change the prints to what your mods are.
Now to add on to this you would just do this for example
you would add this
Code:
void function_2(void)
{
/// Mod 3 here
Print("Menu Slot 3");
}
then you would go down to menu_fun and do this
change
Code:
else if (select == 1)
{
Print("Menu Slot 2");
select=0;
active=2;
}
Code:
else if (select == 1)
{
Print("Menu Slot 2");
select=2;
active=2;
}
Code:
else if (select == 2)
{
select=0; /// Will go back to first option
active=3;
}
Code:
else if (active == 3)
{
function_2();
}
The final code will look like this after you have added a option
Code:
#include <natives.h>
#include <common.h>
#include <strings.h>
#include <types.h>
#include <consts.h>
#define SELECT 0xD
#define START 0xC
#define SQUARE 0xE
#define TRIANGLE 0xF
#define X 0x10
#define CIRCLE 0x11
#define DPAD_UP 0x8
#define DPAD_DOWN 0x9
#define DPAD_LEFT 0xA
#define DPAD_RIGHT 0xB
#define L2 0x5
#define R2 0x7
#define L1 0x4
#define R1 0x6
#define STICK_L 0x12
#define STICK_R 0x13
int menu=0;
int select=0;
int active=0;
// Base made by Chr0m3 x MoDz
void Print(char *string) /// Print function
{
PRINT_STRING_WITH_LITERAL_STRING_NOW("STRING", string, 5000, 1);
}
void function(void)
{
/// Mod 1
Print("Menu Slot 1 Activated");
}
void function_1(void)
{
/// Mod 2
Print("Menu Slot 2 Activated");
}
void function_2(void)
{
/// Mod 3
Print("Menu Slot 3 Activated");
}
void menu_check(void)
{
if (IS_BUTTON_JUST_PRESSED(0, SELECT)) // button press anything in { and } will happen when you press select
{
if (menu == 0)
{
Print("Menu Activated");
menu=1;
}
else if (menu == 1)
{
menu=0;
Print("Menu Disabled");
}
}
}
void menu_fun(void)
{
if (menu == 1)
{
if (IS_BUTTON_JUST_PRESSED(0, DPAD_RIGHT))
{
if (select == 0)
{
Print("Menu Slot 1");
select=1;
active=1;
}
else if (select == 1)
{
Print("Menu Slot 2");
select=2;
active=2;
}
else if (select == 2)
{
Print("Menu Slot 3");
select=0;
active=3;
}
}
}
}
void button(void)
{
if (menu == 1)
{
if (IS_BUTTON_JUST_PRESSED(0, X))
{
if (active == 1)
{
function();
}
else if (active == 2)
{
function_1();
}
else if (active == 3)
{
function_2();
}
}
}
}
void main(void)
{
THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
Print("Chr0m3 x MoDz");
while(true)
{
button();
menu_fun();
menu_check();
WAIT(0);
}
}
Last edited: