Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <xtl.h>
- #include <xboxmath.h>
- // TU9 Function Pointers
- typedef void (*SV_GameSendServerCommand_t)(int clientNum, int type, const char *text);
- SV_GameSendServerCommand_t SV = (SV_GameSendServerCommand_t)0x822548D8;
- typedef int (*Key_IsDown_t)(int clientNum, int buttonEnum);
- Key_IsDown_t Key_IsDown = (Key_IsDown_t)0x821411E0;
- typedef bool (*Dvar_GetBool_t)(const char *dvarName);
- Dvar_GetBool_t Dvar_GetBool = (Dvar_GetBool_t)0x8229EEE8;
- typedef void (*R_AddCmdDrawText_t)(const char*, int, int, int, float, float, float*, int);
- R_AddCmdDrawText_t R_AddCmdDrawText = (R_AddCmdDrawText_t)0x8232B4C8;
- typedef int (*G_Spawn_t)(void);
- G_Spawn_t G_Spawn = (G_Spawn_t)0x8220C7C8;
- typedef void (*G_SetModel_t)(int entity, const char *model);
- G_SetModel_t G_SetModel = (G_SetModel_t)0x8220D1E8;
- typedef void (*G_SetOrigin_t)(int entity, float *origin);
- G_SetOrigin_t G_SetOrigin = (G_SetOrigin_t)0x8220E008;
- typedef void (*G_GetPlayerOrigin_t)(int clientNum, float *origin);
- G_GetPlayerOrigin_t G_GetPlayerOrigin = (G_GetPlayerOrigin_t)0x821E6520;
- // Button Checks
- int LeftBumper() { return Key_IsDown(0, 0x05); }
- int RightBumper() { return Key_IsDown(0, 0x06); }
- int RightStick() { return Key_IsDown(0, 0x11); }
- int DpadUp() { return Key_IsDown(0, 0x14); }
- int DpadDown() { return Key_IsDown(0, 0x15); }
- int AButton() { return Key_IsDown(0, 0x01); }
- int BButton() { return Key_IsDown(0, 0x02); }
- // Notification
- void Notify(const wchar_t* message) {
- typedef void (*XNotifyQueueUI_t)(uint64_t stringId, uint64_t playerIndex, uint64_t r5, wchar_t* displayText, uint64_t r7);
- XNotifyQueueUI_t XNotifyQueueUI = (XNotifyQueueUI_t)0x816B10A0;
- wchar_t buffer[256];
- swprintf(buffer, 256, L"%s", message);
- XNotifyQueueUI(0x22, 0, 2, buffer, 0);
- }
- // Menu State
- int MenuActive = 0;
- int CurrentMenu = 0;
- int Scroll = 0;
- const int MAIN_MENU_COUNT = 6;
- const int MAIN_SUB_COUNT = 4;
- const int ACCOUNT_SUB_COUNT = 5;
- const int BETA_TESTING_SUB_COUNT = 1;
- // Menu Rendering
- void DrawMenu(const char* title, const char* options[], int optionCount, int selected) {
- float white[4] = {1, 1, 1, 1};
- char buffer[256];
- sprintf(buffer, "^7%s", title);
- R_AddCmdDrawText(buffer, 0x7FFFFFFF, 480, 50, 1.2f, 1.2f, white, 0);
- for (int i = 0; i < optionCount; i++) {
- sprintf(buffer, "%s%s", i == selected ? "^2" : "^7", options[i]);
- R_AddCmdDrawText(buffer, 0x7FFFFFFF, 480, 80 + i * 25, 1.0f, 1.0f, white, 0);
- }
- R_AddCmdDrawText("^7Press [{+actionslot 1}]/[{+actionslot 2}] to Scroll", 0x7FFFFFFF, 50, 400, 0.8f, 0.8f, white, 0);
- R_AddCmdDrawText("^7Press [{+gostand}] to Select, [{+stance}] to Back", 0x7FFFFFFF, 50, 420, 0.8f, 0.8f, white, 0);
- }
- // Menu Options
- const char* MainMenuOptions[] = {"Main", "Account", "Lobby", "VIP", "Host", "Beta Testing"};
- const char* MainSubOptions[] = {"Visuals", "Models", "Weapons", "Game Modes"};
- const char* AccountSubOptions[] = {"Select Prestige", "Set Level", "Unlock All", "Custom Classes", "Clan Tags"};
- const char* BetaTestingSubOptions[] = {"Spawn Care Package Base"};
- // Spawn Care Package Base
- void SpawnCarePackageBase() {
- float playerOrigin[3];
- G_GetPlayerOrigin(0, playerOrigin);
- const int width = 3, depth = 3, height = 2;
- const float crateSize = 50.0f;
- for (int x = 0; x < width; x++) {
- for (int z = 0; z < depth; z++) {
- for (int y = 0; y < height; y++) {
- if (y == 1 && x > 0 && x < width - 1 && z > 0 && z < depth - 1) continue;
- int entity = G_Spawn();
- if (entity) {
- G_SetModel(entity, "com_plasticcase_friendly");
- float cratePos[3];
- cratePos[0] = playerOrigin[0] + (x * crateSize) - (width * crateSize / 2);
- cratePos[1] = playerOrigin[1] + (z * crateSize) - (depth * crateSize / 2);
- cratePos[2] = playerOrigin[2] + (y * crateSize);
- G_SetOrigin(entity, cratePos);
- }
- }
- }
- }
- SV(-1, 0, "c \"^2Care Package Base Spawned!\"");
- Notify(L"Care Package Base Spawned");
- }
- // Mod Logic
- void ModLoop() {
- Notify(L"Brzy's Mod Menu Rev 0.1 Loaded - Press LB+RS to Open");
- bool debounce = false;
- float white[4] = {1, 1, 1, 1};
- R_AddCmdDrawText("^7Brzy's Mod Menu Rev 0.1", 0x7FFFFFFF, 50, 30, 1.0f, 1.0f, white, 0); // Updated name
- while (true) {
- if (Dvar_GetBool("cl_ingame")) {
- int lb = LeftBumper();
- int rb = RightBumper();
- int rs = RightStick();
- int du = DpadUp();
- int dd = DpadDown();
- int a = AButton();
- int b = BButton();
- if (lb && rs && !MenuActive && !debounce) {
- MenuActive = 1;
- CurrentMenu = 0;
- Scroll = 0;
- SV(-1, 0, "c \"^2Menu Opened\"");
- Notify(L"Menu Activated");
- debounce = true;
- }
- if (lb && rb && MenuActive && !debounce) {
- MenuActive = 0;
- SV(-1, 0, "c \"^1Menu Closed\"");
- Notify(L"Menu Deactivated");
- debounce = true;
- }
- if (MenuActive) {
- if (du && !debounce) {
- Scroll--;
- if (Scroll < 0) Scroll = (CurrentMenu == 0 ? MAIN_MENU_COUNT : CurrentMenu == 1 ? MAIN_SUB_COUNT : CurrentMenu == 2 ? ACCOUNT_SUB_COUNT : BETA_TESTING_SUB_COUNT) - 1;
- debounce = true;
- }
- if (dd && !debounce) {
- Scroll++;
- if (Scroll >= (CurrentMenu == 0 ? MAIN_MENU_COUNT : CurrentMenu == 1 ? MAIN_SUB_COUNT : CurrentMenu == 2 ? ACCOUNT_SUB_COUNT : BETA_TESTING_SUB_COUNT)) Scroll = 0;
- debounce = true;
- }
- if (a && !debounce) {
- if (CurrentMenu == 0) {
- CurrentMenu = Scroll + 1;
- Scroll = 0;
- SV(-1, 0, "c \"^3Submenu Opened\"");
- }
- else if (CurrentMenu == 6 && Scroll == 0) {
- SpawnCarePackageBase();
- }
- debounce = true;
- }
- if (b && !debounce && CurrentMenu > 0) {
- CurrentMenu = 0;
- Scroll = 0;
- SV(-1, 0, "c \"^3Back to Main\"");
- debounce = true;
- }
- if (CurrentMenu == 0) DrawMenu("MAIN MENU", MainMenuOptions, MAIN_MENU_COUNT, Scroll);
- else if (CurrentMenu == 1) DrawMenu("MAIN", MainSubOptions, MAIN_SUB_COUNT, Scroll);
- else if (CurrentMenu == 2) DrawMenu("ACCOUNT", AccountSubOptions, ACCOUNT_SUB_COUNT, Scroll);
- else if (CurrentMenu == 6) DrawMenu("BETA TESTING", BetaTestingSubOptions, BETA_TESTING_SUB_COUNT, Scroll);
- else DrawMenu(MainMenuOptions[CurrentMenu - 1], MainMenuOptions, 1, 0);
- }
- if (!lb && !rb && !rs && !du && !dd && !a && !b) debounce = false;
- }
- Sleep(50);
- }
- }
- // XEX Entry Point
- extern "C" VOID XexStart() {
- HANDLE thread;
- DWORD threadId;
- ExCreateThread(&thread, 0, &threadId, (PVOID)ModLoop, 0, 0, 0x1);
- XSetThreadProcessor(thread, 4);
- ResumeThread(thread);
- }
- // DLL Export
- extern "C" {
- __declspec(dllexport) DWORD DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved) {
- if (dwReason == DLL_PROCESS_ATTACH) {
- XexStart();
- }
- return TRUE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement