├── Server ├── .gitignore ├── premake5.exe ├── premake5.lua ├── build.cmd ├── Include │ ├── main.h │ ├── types.h │ └── native_caller.h ├── lib.js └── emscripten.lua ├── LambdaMenu ├── lib │ └── ScriptHookV.lib ├── colors.cpp ├── colors.h ├── teleportation.h ├── noclip.h ├── debuglog.h ├── io.h ├── main.cpp ├── types.h ├── inc │ ├── types.h │ ├── main.h │ └── nativeCaller.h ├── debuglog.cpp ├── skins.h ├── Lambda.rc ├── weapons.h ├── io.cpp ├── script.h ├── keyboard.cpp ├── anims.h ├── lm-config.xml ├── config_io.h ├── vehicles.h ├── database.h ├── LambdaMenu.vcxproj.filters ├── config_io.cpp ├── keyboard.h ├── menu_functions.cpp ├── noclip.cpp ├── LambdaMenu.vcxproj ├── teleportation.cpp └── paintmenu.cpp ├── appveyor.yml ├── README.md ├── Client └── Include │ ├── types.h │ ├── main.h │ └── nativeCaller.h ├── LambdaMenu.sln ├── .gitattributes └── .gitignore /Server/.gitignore: -------------------------------------------------------------------------------- 1 | Bin/ 2 | Build/ 3 | Obj/ 4 | whitelist.tmp 5 | whitelist.txt -------------------------------------------------------------------------------- /Server/premake5.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firecul/project-lambdamenu/HEAD/Server/premake5.exe -------------------------------------------------------------------------------- /LambdaMenu/lib/ScriptHookV.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Firecul/project-lambdamenu/HEAD/LambdaMenu/lib/ScriptHookV.lib -------------------------------------------------------------------------------- /LambdaMenu/colors.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int menuColor_RGB[3] = { 117, 27, 241 }; 4 | std::string menuColor_HEX = "#751BF1"; -------------------------------------------------------------------------------- /LambdaMenu/colors.h: -------------------------------------------------------------------------------- 1 | #include 2 | #pragma once 3 | 4 | extern int menuColor_RGB[3]; 5 | extern std::string menuColor_HEX; -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.2.{build} 2 | branches: 3 | only: 4 | - master 5 | max_jobs: 1 6 | image: Visual Studio 2022 7 | configuration: Release 8 | platform: x64 9 | build: 10 | project: LambdaMenu.sln 11 | verbosity: minimal 12 | after_build: 13 | - cmd: 7z a LambdaMenu-%VERSION_NAME%.zip -r .\LambdaMenu\bin\%CONFIGURATION%\LambdaMenu.asi 14 | - cmd: appveyor PushArtifact LambdaMenu-%VERSION_NAME%.zip 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lambda Menu 2 | 3 | [![Build status](https://ci.appveyor.com/api/projects/status/4h4e5r1dd6pk9cg3/branch/master?svg=true)](https://ci.appveyor.com/project/Firecul/project-lambdamenu/branch/master) 4 | 5 | In-game menu for FiveM/Project Λ. 6 | 7 | Project maintained by Firecul in lieu of the CitizenFX Collective. 8 | 9 | I will not make customised versions for anyone. I may tell you basically how but I'm not going to make 100s of different versions. 10 | -------------------------------------------------------------------------------- /LambdaMenu/teleportation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #pragma once 16 | 17 | #include "script.h" 18 | 19 | #include 20 | 21 | bool process_teleport_menu(int categoryIndex); 22 | 23 | void reset_teleporter_globals(); 24 | -------------------------------------------------------------------------------- /LambdaMenu/noclip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #pragma once 16 | 17 | #include "script.h" 18 | 19 | #include 20 | 21 | void process_noclip_menu(); 22 | 23 | void exit_noclip_menu_if_showing(); 24 | 25 | void moveThroughDoor(); 26 | 27 | void noclip(bool inVehicle); 28 | 29 | void create_noclip_help_text(); 30 | 31 | void update_noclip_text(); 32 | 33 | bool is_in_noclip_mode(); -------------------------------------------------------------------------------- /Server/premake5.lua: -------------------------------------------------------------------------------- 1 | dofile('emscripten.lua') 2 | 3 | solution 'lm-sv' 4 | configurations { 'Release' } 5 | 6 | toolset 'emscripten' 7 | 8 | location 'Build/' 9 | 10 | project 'lambdamenu' 11 | targetdir 'Bin/' 12 | objdir 'Obj/' 13 | kind 'ConsoleApp' 14 | targetextension '.bc' 15 | language 'C++' 16 | files { '../LambdaMenu/**.h', '../LambdaMenu/**.cpp', '../LambdaMenu/**.c', '../Server/Source/**.cpp', '../Server/Include/**.h' } 17 | 18 | removefiles { '../**/database_sqlite.cpp', '../**/sqlite3.c' } 19 | 20 | includedirs { '../Server/Include/' } 21 | 22 | defines { 'SERVER_SIDED' } 23 | 24 | optimize 'On' 25 | 26 | --linkoptions '-s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@whitelist.txt -O2 -g --js-library lib.js --memory-init-file 0' -------------------------------------------------------------------------------- /LambdaMenu/debuglog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #ifdef _DEBUG 16 | const bool DEBUG_LOG_ENABLED = true; 17 | #endif 18 | #ifndef _DEBUG 19 | const bool DEBUG_LOG_ENABLED = false; 20 | #endif 21 | 22 | /**Append a line of text to the log file. Does nothing unless the debug 23 | constant is set.*/ 24 | void write_text_to_log_file(const std::string &text); 25 | 26 | /**Wipe the debug log file. Called every time the trainer starts.*/ 27 | void clear_log_file(); -------------------------------------------------------------------------------- /LambdaMenu/io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #pragma once 16 | 17 | #include 18 | #include 19 | #include "inc\enums.h" 20 | 21 | #include 22 | 23 | #include "keyboard.h" 24 | 25 | bool get_key_pressed(int nVirtKey); 26 | 27 | void get_button_state(bool *a, bool *b, bool *up, bool *down, bool *l, bool *r); 28 | 29 | bool trainer_switch_pressed(); 30 | 31 | void reset_trainer_switch(); 32 | 33 | bool noclip_switch_pressed(); 34 | -------------------------------------------------------------------------------- /Server/build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: P:\emsdk\emsdk activate latest 4 | 5 | set CXX=em++ 6 | set CC=emcc 7 | set AR=emar 8 | set CXXFLAGS=--std=gnu++11 -Wno-writable-strings 9 | 10 | premake5 gmake 11 | 12 | pushd Build 13 | make verbose=1 -j2 14 | popd 15 | 16 | call emcc bin\lambdamenu.bc -o "bin\\lambdamenu.html" -s EMTERPRETIFY=1 -s NO_EXIT_RUNTIME=1 -s EMTERPRETIFY_FILE='Bin/data.binary' -s EMTERPRETIFY_ASYNC=1 -O2 -g --js-library lib.js --memory-init-file 1 -s EMTERPRETIFY_ADVISE=1 2>&1 > whitelist.tmp 17 | cat whitelist.tmp | tr '\n' '\r' | sed 's/.*WHITELIST=.\(.*\)\'.*/\1/' > whitelist.txt 18 | del whitelist.tmp 19 | 20 | call emcc bin\lambdamenu.bc -o "bin\\lambdamenu.html" -s EMTERPRETIFY=1 -s NO_EXIT_RUNTIME=1 -s EMTERPRETIFY_FILE='Bin/data.binary' -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@whitelist.txt -O2 -g --js-library lib.js --memory-init-file 1 21 | del whitelist.txt 22 | -------------------------------------------------------------------------------- /LambdaMenu/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include 16 | #include "script.h" 17 | #include "keyboard.h" 18 | #include "config_io.h" 19 | #include "debuglog.h" 20 | 21 | #include 22 | 23 | BOOL APIENTRY DllMain(HMODULE hInstance, DWORD reason, LPVOID lpReserved) 24 | { 25 | switch (reason) 26 | { 27 | case DLL_PROCESS_ATTACH: 28 | scriptRegister(hInstance, ScriptMain); 29 | keyboardHandlerRegister(OnKeyboardMessage); 30 | break; 31 | case DLL_PROCESS_DETACH: 32 | scriptUnregister(ScriptMain); 33 | keyboardHandlerUnregister(OnKeyboardMessage); 34 | ScriptTidyUp(); 35 | break; 36 | } 37 | return TRUE; 38 | } -------------------------------------------------------------------------------- /LambdaMenu/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | typedef DWORD Void; 12 | typedef DWORD Any; 13 | typedef DWORD uint; 14 | typedef DWORD Hash; 15 | typedef int Entity; 16 | typedef int Player; 17 | typedef int FireId; 18 | typedef int Ped; 19 | typedef int Vehicle; 20 | typedef int Cam; 21 | typedef int CarGenerator; 22 | typedef int Group; 23 | typedef int Train; 24 | typedef int Pickup; 25 | typedef int Object; 26 | typedef int Weapon; 27 | typedef int Interior; 28 | typedef int Blip; 29 | typedef int Texture; 30 | typedef int TextureDict; 31 | typedef int CoverPoint; 32 | typedef int Camera; 33 | typedef int TaskSequence; 34 | typedef int ColourIndex; 35 | typedef int Sphere; 36 | typedef int ScrHandle; 37 | 38 | #pragma pack(push, 1) 39 | typedef struct 40 | { 41 | float x; 42 | DWORD _paddingx; 43 | float y; 44 | DWORD _paddingy; 45 | float z; 46 | DWORD _paddingz; 47 | } Vector3; 48 | #pragma pack(pop) -------------------------------------------------------------------------------- /Client/Include/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | typedef DWORD Void; 12 | typedef DWORD Any; 13 | typedef DWORD uint; 14 | typedef DWORD Hash; 15 | typedef int Entity; 16 | typedef int Player; 17 | typedef int FireId; 18 | typedef int Ped; 19 | typedef int Vehicle; 20 | typedef int Cam; 21 | typedef int CarGenerator; 22 | typedef int Group; 23 | typedef int Train; 24 | typedef int Pickup; 25 | typedef int Object; 26 | typedef int Weapon; 27 | typedef int Interior; 28 | typedef int Blip; 29 | typedef int Texture; 30 | typedef int TextureDict; 31 | typedef int CoverPoint; 32 | typedef int Camera; 33 | typedef int TaskSequence; 34 | typedef int ColourIndex; 35 | typedef int Sphere; 36 | typedef int ScrHandle; 37 | 38 | #pragma pack(push, 1) 39 | typedef struct 40 | { 41 | float x; 42 | DWORD _paddingx; 43 | float y; 44 | DWORD _paddingy; 45 | float z; 46 | DWORD _paddingz; 47 | } Vector3; 48 | #pragma pack(pop) -------------------------------------------------------------------------------- /LambdaMenu/inc/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | typedef DWORD Void; 12 | typedef DWORD Any; 13 | typedef DWORD uint; 14 | typedef DWORD Hash; 15 | typedef int Entity; 16 | typedef int Player; 17 | typedef int FireId; 18 | typedef int Ped; 19 | typedef int Vehicle; 20 | typedef int Cam; 21 | typedef int CarGenerator; 22 | typedef int Group; 23 | typedef int Train; 24 | typedef int Pickup; 25 | typedef int Object; 26 | typedef int Weapon; 27 | typedef int Interior; 28 | typedef int Blip; 29 | typedef int Texture; 30 | typedef int TextureDict; 31 | typedef int CoverPoint; 32 | typedef int Camera; 33 | typedef int TaskSequence; 34 | typedef int ColourIndex; 35 | typedef int Sphere; 36 | typedef int ScrHandle; 37 | 38 | #pragma pack(push, 1) 39 | typedef struct 40 | { 41 | float x; 42 | DWORD _paddingx; 43 | float y; 44 | DWORD _paddingy; 45 | float z; 46 | DWORD _paddingz; 47 | } Vector3; 48 | #pragma pack(pop) -------------------------------------------------------------------------------- /LambdaMenu/debuglog.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "debuglog.h" 21 | 22 | void clear_log_file() 23 | { 24 | remove("lm-log.txt"); 25 | } 26 | 27 | #define DTTMFMT "%Y-%m-%d %H:%M:%S " 28 | #define DTTMSZ 21 29 | static char *getDtTm(char *buff) 30 | { 31 | time_t t = time(0); 32 | strftime(buff, DTTMSZ, DTTMFMT, localtime(&t)); 33 | return buff; 34 | } 35 | 36 | void write_text_to_log_file(const std::string &text) 37 | { 38 | printf("%s\n", text.c_str()); 39 | 40 | if (true) 41 | { 42 | return; 43 | } 44 | 45 | char tbuff[DTTMSZ]; 46 | std::ofstream log_file("lm-log.txt", std::ios_base::out | std::ios_base::app); 47 | log_file << getDtTm(tbuff) << text << std::endl; 48 | log_file.close(); 49 | } -------------------------------------------------------------------------------- /LambdaMenu/skins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #pragma once 16 | 17 | #include "script.h" 18 | #include "menu_functions.h" 19 | 20 | #include 21 | 22 | /*** 23 | * METHODS 24 | */ 25 | 26 | bool applyChosenSkin(std::string skinName); 27 | 28 | bool applyChosenSkin(DWORD model); 29 | 30 | void reset_skin_globals(); 31 | 32 | bool process_skinchanger_menu(); 33 | 34 | bool process_prop_menu(); 35 | 36 | bool onconfirm_props_texture_menu(MenuItem choice); 37 | 38 | void onhighlight_props_texture_menu(MenuItem choice); 39 | 40 | //Save related stuff 41 | 42 | bool skin_save_menu_interrupt(); 43 | 44 | bool skin_save_slot_menu_interrupt(); 45 | 46 | bool process_savedskin_menu(); 47 | 48 | bool process_savedskin_slot_menu(int slot); 49 | 50 | bool spawn_saved_skin(int slot, std::string caption); 51 | 52 | void save_current_skin(int slot); -------------------------------------------------------------------------------- /LambdaMenu/Lambda.rc: -------------------------------------------------------------------------------- 1 | FX_ASI_BUILD 1604 2 | BEGIN 3 | "\0" 4 | END 5 | 6 | FX_ASI_BUILD 2060 7 | BEGIN 8 | "\0" 9 | END 10 | 11 | FX_ASI_BUILD 2189 12 | BEGIN 13 | "\0" 14 | END 15 | 16 | FX_ASI_BUILD 2372 17 | BEGIN 18 | "\0" 19 | END 20 | 21 | FX_ASI_BUILD 2545 22 | BEGIN 23 | "\0" 24 | END 25 | 26 | FX_ASI_BUILD 2612 27 | BEGIN 28 | "\0" 29 | END 30 | 31 | FX_ASI_BUILD 2628 32 | BEGIN 33 | "\0" 34 | END 35 | 36 | FX_ASI_BUILD 2699 37 | BEGIN 38 | "\0" 39 | END 40 | 41 | FX_ASI_BUILD 2802 42 | BEGIN 43 | "\0" 44 | END 45 | 46 | FX_ASI_BUILD 2824 47 | BEGIN 48 | "\0" 49 | END 50 | 51 | FX_ASI_BUILD 2845 52 | BEGIN 53 | "\0" 54 | END 55 | 56 | FX_ASI_BUILD 2944 57 | BEGIN 58 | "\0" 59 | END 60 | 61 | FX_ASI_BUILD 3028 62 | BEGIN 63 | "\0" 64 | END 65 | 66 | FX_ASI_BUILD 3095 67 | BEGIN 68 | "\0" 69 | END 70 | 71 | FX_ASI_BUILD 3179 72 | BEGIN 73 | "\0" 74 | END 75 | 76 | FX_ASI_BUILD 3258 77 | BEGIN 78 | "\0" 79 | END 80 | 81 | FX_ASI_BUILD 3274 82 | BEGIN 83 | "\0" 84 | END 85 | 86 | FX_ASI_BUILD 3323 87 | BEGIN 88 | "\0" 89 | END 90 | 91 | FX_ASI_BUILD 3337 92 | BEGIN 93 | "\0" 94 | END 95 | 96 | FX_ASI_BUILD 3351 97 | BEGIN 98 | "\0" 99 | END 100 | 101 | FX_ASI_BUILD 3407 102 | BEGIN 103 | "\0" 104 | END 105 | 106 | FX_ASI_BUILD 3411 107 | BEGIN 108 | "\0" 109 | END 110 | -------------------------------------------------------------------------------- /Server/Include/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "types.h" 10 | 11 | #define IMPORT extern "C" 12 | 13 | typedef void* HMODULE; 14 | 15 | IMPORT void scriptWait(DWORD time); 16 | IMPORT void scriptRegister(HMODULE module, void(*LP_SCRIPT_MAIN)()); 17 | IMPORT void scriptRegisterAdditionalThread(HMODULE module, void(*LP_SCRIPT_MAIN)()); 18 | //IMPORT void scriptUnregister(HMODULE module); 19 | IMPORT void scriptUnregister(void(*LP_SCRIPT_MAIN)()); // deprecated 20 | 21 | typedef void(*KeyboardHandler)(DWORD, WORD, BYTE, BOOL, BOOL, BOOL, BOOL); 22 | 23 | IMPORT void keyboardHandlerRegister(KeyboardHandler handler); 24 | IMPORT void keyboardHandlerUnregister(KeyboardHandler handler); 25 | 26 | IMPORT void nativeInit(const char* hash); 27 | IMPORT void nativePush64(UINT64 val); 28 | IMPORT void nativePushFloat(float val); 29 | IMPORT void nativePushInt(int val); 30 | IMPORT void nativePushPtr(int type, void* val); 31 | IMPORT void nativePushString(const char* val); 32 | IMPORT PUINT64 nativeCall(); 33 | IMPORT int nativeCallInt(); 34 | IMPORT char* nativeCallString(); 35 | IMPORT float nativeCallFloat(); 36 | IMPORT void nativeCallVector3(float* x, float* y, float* z); 37 | 38 | #include 39 | 40 | static void WAIT(DWORD time) { emscripten_sleep(time); } 41 | static void TERMINATE() { WAIT(MAXDWORD); } 42 | 43 | DWORD GetTickCount(); -------------------------------------------------------------------------------- /Server/Include/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | typedef char* LPSTR; 12 | typedef uint64_t UINT64; 13 | typedef UINT64* PUINT64; 14 | typedef uint32_t DWORD; 15 | typedef uint16_t WORD; 16 | typedef uint8_t BYTE; 17 | typedef int BOOL; 18 | 19 | #define FALSE false 20 | #define TRUE true 21 | 22 | #define MAXDWORD UINT32_MAX 23 | 24 | typedef DWORD Void; 25 | typedef DWORD Any; 26 | typedef DWORD uint; 27 | typedef DWORD Hash; 28 | typedef int Entity; 29 | typedef int Player; 30 | typedef int FireId; 31 | typedef int Ped; 32 | typedef int Vehicle; 33 | typedef int Cam; 34 | typedef int CarGenerator; 35 | typedef int Group; 36 | typedef int Train; 37 | typedef int Pickup; 38 | typedef int Object; 39 | typedef int Weapon; 40 | typedef int Interior; 41 | typedef int Blip; 42 | typedef int Texture; 43 | typedef int TextureDict; 44 | typedef int CoverPoint; 45 | typedef int Camera; 46 | typedef int TaskSequence; 47 | typedef int ColourIndex; 48 | typedef int Sphere; 49 | typedef int ScrHandle; 50 | 51 | #pragma pack(push, 1) 52 | struct Vector3 53 | { 54 | float x; 55 | DWORD _paddingx; 56 | float y; 57 | DWORD _paddingy; 58 | float z; 59 | DWORD _paddingz; 60 | 61 | inline Vector3() 62 | { 63 | 64 | } 65 | 66 | inline Vector3(float x, float y, float z) 67 | : x(x), y(y), z(z) 68 | { 69 | 70 | } 71 | }; 72 | #pragma pack(pop) -------------------------------------------------------------------------------- /LambdaMenu/weapons.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #pragma once 16 | 17 | #include "script.h" 18 | #include "menu_functions.h" 19 | 20 | #include "database.h" 21 | 22 | void process_weapon_menu(); 23 | 24 | bool do_give_weapon(std::string modelName); 25 | bool process_weaponlist_menu(); 26 | 27 | void reset_weapon_globals(); 28 | 29 | void update_weapon_features(BOOL bPlayerExists, Player player); 30 | 31 | void save_player_weapons(); 32 | 33 | void restore_player_weapons(); 34 | 35 | bool is_weapon_equipped(std::vector extras); 36 | 37 | void set_weapon_equipped(bool equipped, std::vector extras); 38 | 39 | bool is_weaponmod_equipped(std::vector extras); 40 | 41 | void set_weaponmod_equipped(bool equipped, std::vector extras); 42 | 43 | void give_weapon_clip(MenuItem choice); 44 | 45 | void fill_weapon_ammo(MenuItem choice); 46 | 47 | void onconfirm_open_tint_menu(MenuItem choice); 48 | 49 | //Weapon mod menu 50 | 51 | bool onconfirm_weapon_mod_menu_tint(MenuItem choice); 52 | 53 | std::vector get_feature_enablements_weapons(); 54 | 55 | bool weapon_reequip_interrupt(); -------------------------------------------------------------------------------- /LambdaMenu.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29613.14 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LambdaMenu", "LambdaMenu\LambdaMenu.vcxproj", "{8D82F34A-1D64-465B-84B1-37F89AD3D20B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Development|x64 = Development|x64 12 | EnhancedReborn_DB|x64 = EnhancedReborn_DB|x64 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B}.Debug|x64.ActiveCfg = Debug|x64 17 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B}.Debug|x64.Build.0 = Debug|x64 18 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B}.Development|x64.ActiveCfg = Development|x64 19 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B}.Development|x64.Build.0 = Development|x64 20 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B}.EnhancedReborn_DB|x64.ActiveCfg = EnhancedReborn_DB|x64 21 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B}.EnhancedReborn_DB|x64.Build.0 = EnhancedReborn_DB|x64 22 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B}.Release|x64.ActiveCfg = Release|x64 23 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {12290B17-542F-448E-AC67-5D0F706442BE} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /LambdaMenu/io.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include "io.h" 16 | #include "config_io.h" 17 | #include 18 | #include 19 | 20 | DWORD trainerResetTime = 0; 21 | 22 | bool trainer_switch_pressed() 23 | { 24 | return IsKeyJustUp( config->get_key_config()->key_toggle_main_menu ); 25 | } 26 | 27 | void get_button_state(bool *a, bool *b, bool *up, bool *down, bool *l, bool *r) 28 | { 29 | KeyInputConfig *keyConf = config->get_key_config(); 30 | 31 | if (a) 32 | { 33 | *a = IsKeyDown(keyConf->key_menu_confirm); 34 | } 35 | 36 | if (b) 37 | { 38 | *b = IsKeyDown(keyConf->key_menu_back); 39 | } 40 | 41 | if (up) 42 | { 43 | *up = IsKeyDown(keyConf->key_menu_up); 44 | } 45 | 46 | if (down) 47 | { 48 | *down = IsKeyDown(keyConf->key_menu_down); 49 | } 50 | 51 | if (r) 52 | { 53 | *r = IsKeyDown(keyConf->key_menu_right); 54 | } 55 | 56 | if (l) 57 | { 58 | *l = IsKeyDown(keyConf->key_menu_left); 59 | } 60 | } 61 | 62 | bool get_key_pressed(int nVirtKey) 63 | { 64 | //return (GetKeyState(nVirtKey) & 0x8000) != 0; 65 | return (GetAsyncKeyState(nVirtKey) & 0x8000) != 0; 66 | } 67 | 68 | bool noclip_switch_pressed() 69 | { 70 | return IsKeyJustUp(get_config()->get_key_config()->key_toggle_noclip); 71 | } 72 | 73 | 74 | void reset_trainer_switch() 75 | { 76 | trainerResetTime = GetTickCount(); 77 | } -------------------------------------------------------------------------------- /LambdaMenu/script.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #pragma once 16 | 17 | #include 18 | #include 19 | #include "inc/enums.h" 20 | 21 | #include 22 | 23 | #include "database.h" 24 | 25 | #include 26 | 27 | //Ensures numbers are formatted with commas, not the locale option 28 | class comma_numpunct : public std::numpunct 29 | { 30 | protected: 31 | virtual char do_thousands_sep() const 32 | { 33 | return ','; 34 | } 35 | 36 | virtual std::string do_grouping() const 37 | { 38 | return "\03"; 39 | } 40 | }; 41 | 42 | void ScriptMain(); 43 | 44 | void ScriptTidyUp(); 45 | 46 | bool process_ani_menu(); 47 | 48 | bool process_skinchanger_menu(); 49 | 50 | bool process_skinchanger_detail_menu(); 51 | 52 | void update_features(); 53 | 54 | void change_color_of_all_hud_ids(int r, int g, int b, int a); 55 | 56 | void reset_globals(); 57 | 58 | void set_all_nearby_peds_to_calm(Ped playerPed, int count); 59 | 60 | //DB persistent stuff 61 | 62 | std::vector get_feature_enablements(); 63 | 64 | void turn_off_never_wanted(); 65 | 66 | void load_settings(); 67 | 68 | void save_settings(); 69 | 70 | DWORD WINAPI save_settings_thread(LPVOID lpParameter); 71 | 72 | void init_storage(); 73 | 74 | WCHAR* get_storage_dir_path(); 75 | 76 | WCHAR* get_storage_dir_path(char* file); 77 | 78 | WCHAR* get_temp_dir_path(); 79 | 80 | WCHAR* get_temp_dir_path(char* file); 81 | 82 | ERDatabase* get_database(); -------------------------------------------------------------------------------- /LambdaMenu/keyboard.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #include "keyboard.h" 8 | #include "script.h" 9 | #include "debuglog.h" 10 | 11 | #include 12 | 13 | const int KEYS_SIZE = 255; 14 | 15 | struct { 16 | DWORD time; 17 | BOOL isWithAlt; 18 | BOOL wasDownBefore; 19 | BOOL isUpNow; 20 | } 21 | 22 | keyStates[KEYS_SIZE]; 23 | 24 | void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow) 25 | { 26 | if (key < KEYS_SIZE) 27 | { 28 | keyStates[key].time = GetTickCount(); 29 | keyStates[key].isWithAlt = isWithAlt; 30 | keyStates[key].wasDownBefore = wasDownBefore; 31 | keyStates[key].isUpNow = isUpNow; 32 | } 33 | } 34 | 35 | const int NOW_PERIOD = 100, MAX_DOWN = 5000; // ms 36 | 37 | bool IsKeyDown(DWORD key) 38 | { 39 | return (key < KEYS_SIZE) ? ((GetTickCount() < keyStates[key].time + MAX_DOWN) && !keyStates[key].isUpNow) : false; 40 | } 41 | 42 | bool IsKeyJustUp(DWORD key, bool exclusive) 43 | { 44 | bool b = (key < KEYS_SIZE) ? (GetTickCount() < keyStates[key].time + NOW_PERIOD && keyStates[key].isUpNow) : false; 45 | if (b && exclusive) 46 | { 47 | ResetKeyState(key); 48 | } 49 | 50 | return b; 51 | } 52 | 53 | void ResetKeyState(DWORD key) 54 | { 55 | if (key < KEYS_SIZE) 56 | { 57 | memset(&keyStates[key], 0, sizeof(keyStates[0])); 58 | } 59 | } 60 | 61 | int keyNameToVal(char * input) 62 | { 63 | std::ostringstream ss; 64 | ss << "Searching for " << input; 65 | write_text_to_log_file(ss.str()); 66 | 67 | for (int i = 0; i < (sizeof ALL_KEYS / sizeof ALL_KEYS[0]); i++) 68 | { 69 | if (strcmp(input, ALL_KEYS[i].name) == 0) 70 | { 71 | ss.str(""); 72 | ss.clear(); 73 | ss << "Found match of " << ALL_KEYS[i].name << " with code " << ALL_KEYS[i].keyCode; 74 | write_text_to_log_file(ss.str()); 75 | 76 | return ALL_KEYS[i].keyCode; 77 | } 78 | } 79 | 80 | return -1; 81 | } -------------------------------------------------------------------------------- /LambdaMenu/anims.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #pragma once 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | class TreeNode 24 | { 25 | public: 26 | TreeNode* parent = NULL; 27 | std::string value; 28 | bool isRoot = false; 29 | std::vector children; 30 | 31 | bool hasChildren() 32 | { 33 | return children.size() > 0; 34 | }; 35 | 36 | inline TreeNode* findChildWithValue(std::string value) 37 | { 38 | for (TreeNode *child : children) 39 | { 40 | if (child->value.compare(value) == 0) 41 | { 42 | return child; 43 | } 44 | } 45 | return NULL; 46 | } 47 | 48 | inline TreeNode* addChild(std::string value) 49 | { 50 | TreeNode *newChild = new TreeNode(); 51 | newChild->value = value; 52 | newChild->parent = this; 53 | children.push_back(newChild); 54 | return newChild; 55 | } 56 | 57 | std::string getFullDict() 58 | { 59 | std::stringstream ss; 60 | 61 | if (parent != NULL) 62 | { 63 | ss << parent->getFullDict(); 64 | } 65 | if (this->hasChildren() && parent != NULL && !parent->isRoot) 66 | { 67 | ss << "@"; 68 | } 69 | if (this->hasChildren()) 70 | { 71 | ss << value; 72 | } 73 | 74 | auto result = ss.str(); 75 | return result; 76 | } 77 | 78 | inline ~TreeNode() 79 | { 80 | for (std::vector::iterator it = children.begin(); it != children.end(); ++it) 81 | { 82 | delete (*it); 83 | } 84 | children.clear(); 85 | }; 86 | }; 87 | 88 | void build_anim_tree(); 89 | 90 | TreeNode* build_anim_tree(std::vector input); 91 | 92 | TreeNode* build_anim_tree_with_suffix_filter(std::string filter); 93 | 94 | bool process_anims_menu(); 95 | 96 | bool process_anims_menu_top(); 97 | 98 | void update_actions(); -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain -------------------------------------------------------------------------------- /LambdaMenu/lm-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /LambdaMenu/config_io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | #import //read the GitHub project readme regarding what you need to make this work 21 | 22 | #include "keyboard.h" 23 | 24 | /**A class to hold the current key bindings.*/ 25 | class KeyInputConfig 26 | { 27 | public: 28 | //these are the defaults which may be overridden by the XML config 29 | 30 | //menu controls 31 | int key_toggle_main_menu = VK_F1; 32 | int key_menu_up = VK_NUMPAD8; 33 | int key_menu_down = VK_NUMPAD2; 34 | int key_menu_left = VK_NUMPAD4; 35 | int key_menu_right = VK_NUMPAD6; 36 | int key_menu_confirm = VK_NUMPAD5; 37 | int key_menu_back = VK_NUMPAD0; 38 | 39 | //noclip controls 40 | int key_toggle_noclip = VK_F2; 41 | int key_noclip_up = VK_KEY_Q; 42 | int key_noclip_down = VK_KEY_Z; 43 | int key_noclip_forward = VK_KEY_W; 44 | int key_noclip_back = VK_KEY_S; 45 | int key_noclip_rotate_left = VK_KEY_A; 46 | int key_noclip_rotate_right = VK_KEY_D; 47 | int key_noclip_speed = VK_SHIFT; 48 | 49 | //editor controls 50 | int toggle_editor = VK_F3; 51 | int discard_recording = VK_DELETE; 52 | 53 | //player controls 54 | int player_ragdoll = NULL; 55 | int ragdoll_force = NULL; 56 | int pointing_action = NULL; 57 | 58 | //teleport controls 59 | int teleport_to_marker = NULL; 60 | 61 | //vehicle controls 62 | int key_veh_boost = NULL; 63 | int key_veh_stop = NULL; 64 | int left_signal = NULL; 65 | int right_signal = NULL; 66 | int interior_light = NULL; 67 | int front_windows_up = NULL; 68 | int front_windows_down = NULL; 69 | int no_siren = NULL; 70 | int drift_mode = NULL; 71 | 72 | //game controls 73 | int player_names = NULL; 74 | int player_names_vehicles = NULL; 75 | int map_cycle = NULL; 76 | int push_through_wall = NULL; 77 | 78 | 79 | //hotkey modifier one controls 80 | int hotkey_modifier_one = NULL; 81 | int back_windows_up = NULL; 82 | int back_windows_down = NULL; 83 | int door_front_left = NULL; 84 | int hood = NULL; 85 | int door_front_right = NULL; 86 | int door_back_left = NULL; 87 | int trunk = NULL; 88 | int door_back_right = NULL; 89 | 90 | //hotkey modifier two controls 91 | int hotkey_modifier_two = NULL; 92 | 93 | 94 | /**Change the key binding using a function string and key string.*/ 95 | void set_key(char* function, char* keyName); 96 | }; 97 | 98 | /**A class to hold all the user settings.*/ 99 | class TrainerConfig 100 | { 101 | public: 102 | TrainerConfig(); 103 | KeyInputConfig* get_key_config() { return keyConfig; } 104 | 105 | private: 106 | KeyInputConfig* keyConfig; 107 | }; 108 | 109 | /**The current user config.*/ 110 | extern TrainerConfig* config; 111 | 112 | /**Read the user config in from an XML file.*/ 113 | void read_config_file(); 114 | 115 | /**Get the current config object.*/ 116 | inline TrainerConfig* get_config() { return config; } 117 | -------------------------------------------------------------------------------- /Server/Include/native_caller.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "main.h" 10 | 11 | template 12 | inline void nativePush(T val) 13 | { 14 | UINT64 val64 = 0; 15 | if (sizeof(T) > sizeof(UINT64)) 16 | { 17 | throw "error, value size > 64 bit"; 18 | } 19 | *reinterpret_cast(&val64) = val; // &val + sizeof(dw) - sizeof(val) 20 | nativePush64(val64); 21 | } 22 | 23 | template<> 24 | inline void nativePush(const char* val) 25 | { 26 | nativePushString(val); 27 | } 28 | 29 | template<> 30 | inline void nativePush(char* val) 31 | { 32 | nativePushString(val); 33 | } 34 | 35 | template<> 36 | inline void nativePush(BOOL val) 37 | { 38 | nativePushInt(val); 39 | } 40 | 41 | template<> 42 | inline void nativePush(uint32_t val) 43 | { 44 | nativePushInt(val); 45 | } 46 | 47 | template<> 48 | inline void nativePush(float val) 49 | { 50 | nativePushFloat(val); 51 | } 52 | 53 | template<> 54 | inline void nativePush(double val) 55 | { 56 | nativePush(static_cast(val)); 57 | } 58 | 59 | template<> 60 | inline void nativePush(Vector3* ptr) 61 | { 62 | nativePushPtr(4, ptr); 63 | } 64 | 65 | template<> 66 | inline void nativePush(float* ptr) 67 | { 68 | nativePushPtr(3, ptr); 69 | } 70 | 71 | template<> 72 | inline void nativePush(uint32_t* ptr) 73 | { 74 | nativePushPtr(2, ptr); 75 | } 76 | 77 | template<> 78 | inline void nativePush(int* ptr) 79 | { 80 | nativePushPtr(1, ptr); 81 | } 82 | 83 | template<> 84 | inline void nativePush(void* ptr) 85 | { 86 | nativePushPtr(0, ptr); 87 | } 88 | 89 | template 90 | inline TRet nativeCallTemplated() 91 | { 92 | //static_assert(false, "don't!"); 93 | nativeCall(); 94 | } 95 | 96 | template<> 97 | inline void nativeCallTemplated() 98 | { 99 | nativeCall(); 100 | } 101 | 102 | template<> 103 | inline int* nativeCallTemplated() 104 | { 105 | return nullptr; 106 | } 107 | 108 | template<> 109 | inline uint32_t* nativeCallTemplated() 110 | { 111 | return nullptr; 112 | } 113 | 114 | template<> 115 | inline int nativeCallTemplated() 116 | { 117 | return nativeCallInt(); 118 | } 119 | 120 | template<> 121 | inline unsigned int nativeCallTemplated() 122 | { 123 | return nativeCallInt(); 124 | } 125 | 126 | template<> 127 | inline char* nativeCallTemplated() 128 | { 129 | return nativeCallString(); 130 | } 131 | 132 | template<> 133 | inline const char* nativeCallTemplated() 134 | { 135 | return nativeCallString(); 136 | } 137 | 138 | template<> 139 | inline float nativeCallTemplated() 140 | { 141 | return nativeCallFloat(); 142 | } 143 | 144 | template<> 145 | inline Vector3 nativeCallTemplated() 146 | { 147 | float x, y, z; 148 | nativeCallVector3(&x, &y, &z); 149 | 150 | Vector3 v; 151 | v.x = x; 152 | v.y = y; 153 | v.z = z; 154 | 155 | return v; 156 | } 157 | 158 | struct pass 159 | { 160 | template pass(T...) {} 161 | }; 162 | 163 | template 164 | static inline R invoke(UINT64 hash, Args... args) 165 | { 166 | char hashString[64]; 167 | sprintf(hashString, "%llx", hash); 168 | 169 | nativeInit(hashString); 170 | 171 | pass{ ([&] () 172 | { 173 | nativePush(args); 174 | }(), 1)... }; 175 | 176 | return nativeCallTemplated(); 177 | } -------------------------------------------------------------------------------- /LambdaMenu/vehicles.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #pragma once 16 | 17 | #include "script.h" 18 | 19 | #include "menu_functions.h" 20 | #include "database.h" 21 | 22 | #include 23 | 24 | /*** 25 | * METHODS 26 | */ 27 | 28 | void process_veh_menu(); 29 | 30 | bool process_savedveh_menu(); 31 | 32 | bool process_savedveh_slot_menu(int slot); 33 | 34 | bool process_vehmod_menu(); 35 | 36 | bool process_carspawn_menu(); 37 | 38 | void update_vehicle_features(BOOL playerExists, Ped playerPed); 39 | 40 | void reset_vehicle_globals(); 41 | 42 | bool process_spawn_menu_cars(); 43 | 44 | bool process_spawn_menu_indus(); 45 | 46 | bool process_spawn_menu_generic(int topMenuSelection); 47 | 48 | bool spawn_saved_car(int slot, std::string caption); 49 | 50 | void save_current_vehicle(int slot); 51 | 52 | bool onconfirm_spawn_menu_vehicle_selection(MenuItem choice); 53 | 54 | bool do_spawn_vehicle(std::string modelName, std::string modelTitle); 55 | 56 | Vehicle do_spawn_vehicle(DWORD modelHash, std::string modelTitle); 57 | 58 | //Paint menus 59 | 60 | bool process_paint_menu(); 61 | 62 | bool process_paint_menu_type(); 63 | 64 | bool process_paint_menu_liveries(); 65 | 66 | bool process_paint_menu_special(); 67 | 68 | bool onconfirm_color_menu_selection(MenuItem choice); 69 | 70 | void onhighlight_color_menu_selection(MenuItem choice); 71 | 72 | //Vehicle mod getters and setters 73 | 74 | bool is_custom_tyres(std::vector extras); 75 | 76 | void set_custom_tyres(bool applied, std::vector extras); 77 | 78 | bool is_turbocharged(std::vector extras); 79 | 80 | void set_turbocharged(bool applied, std::vector extras); 81 | 82 | bool is_bulletproof_tyres(std::vector extras); 83 | 84 | void set_bulletproof_tyres(bool applied, std::vector extras); 85 | 86 | bool is_xenon_headlights(std::vector extras); 87 | 88 | void set_xenon_headlights(bool applied, std::vector extras); 89 | 90 | bool is_neon_lights(std::vector extras); 91 | 92 | void set_neon_lights(bool applied, std::vector extras); 93 | 94 | bool is_tire_smoke(std::vector extras); 95 | 96 | void set_tire_smoke(bool applied, std::vector extras); 97 | 98 | bool is_extra_enabled(std::vector extras); 99 | 100 | void set_extra_enabled(bool applied, std::vector extras); 101 | 102 | void set_plate_text(MenuItem choice); 103 | 104 | int find_menu_index_to_restore(int category, int actualCategory, Vehicle veh); 105 | 106 | bool vehicle_menu_interrupt(); 107 | 108 | bool vehicle_save_menu_interrupt(); 109 | 110 | bool vehicle_save_slot_menu_interrupt(); 111 | 112 | std::vector get_feature_enablements_vehicles(); 113 | 114 | void add_vehicle_generic_settings(std::vector* results); 115 | 116 | void handle_generic_settings_vehicle(std::vector* settings); 117 | 118 | struct PaintColour 119 | { 120 | std::string name; 121 | int mainValue; 122 | int pearlAddition; 123 | }; 124 | 125 | void apply_paint(PaintColour whichpaint); -------------------------------------------------------------------------------- /Server/lib.js: -------------------------------------------------------------------------------- 1 | var library = { 2 | '$NATIVE': { 3 | callNative: function() 4 | { 5 | 'use strict'; 6 | 7 | let args = [ nativeState.hash ]; 8 | let hadPointer = false; 9 | 10 | let pointerTypes = []; 11 | 12 | for (let arg of nativeState.arguments) 13 | { 14 | if (arg.type == 'ptr') 15 | { 16 | switch (arg.ptrType) 17 | { 18 | case 1: 19 | case 2: 20 | args.push(Citizen.pointerValueIntInitialized(getValue(arg.ptr, 'i32'))); 21 | pointerTypes.push(arg); 22 | break; 23 | 24 | case 3: 25 | args.push(Citizen.pointerValueFloatInitialized(getValue(arg.ptr, 'float'))); 26 | pointerTypes.push(arg); 27 | break; 28 | 29 | case 4: 30 | args.push(Citizen.pointerValueVector()); 31 | pointerTypes.push(arg); 32 | break; 33 | } 34 | 35 | hadPointer = true; 36 | } 37 | else 38 | { 39 | args.push(arg.val); 40 | } 41 | } 42 | 43 | for (let arg of arguments) 44 | { 45 | args.push(arg); 46 | } 47 | 48 | args.push(Citizen.returnResultAnyway()); 49 | 50 | let retval = Citizen.invokeNative.apply(this, args); 51 | 52 | if (!hadPointer) 53 | { 54 | return retval; 55 | } 56 | 57 | let singleValue = retval.shift(); 58 | 59 | for (let i = 0; i < pointerTypes.length; i++) 60 | { 61 | let val = retval[i]; 62 | let pt = pointerTypes[i]; 63 | 64 | if (pt.ptrType == 4) 65 | { 66 | setValue(pt.ptr, val[0], 'float'); 67 | setValue(pt.ptr + 8, val[1], 'float'); 68 | setValue(pt.ptr + 16, val[2], 'float'); 69 | } 70 | else if (pt.ptrType == 1 || pt.ptrType == 2) 71 | { 72 | setValue(pt.ptr, val, 'i32'); 73 | } 74 | else if (pt.ptrType == 3) 75 | { 76 | setValue(pt.ptr, val, 'float'); 77 | } 78 | } 79 | 80 | return singleValue; 81 | } 82 | }, 83 | 84 | 'nativeInit': function(hashString) 85 | { 86 | hashString = Pointer_stringify(hashString); 87 | 88 | nativeState = { 89 | hash: hashString, 90 | arguments: [] 91 | }; 92 | }, 93 | 94 | 'nativePushPtr': function(type, ptr) 95 | { 96 | nativeState.arguments.push( 97 | { 98 | type: 'ptr', 99 | ptrType: type, 100 | ptr: ptr 101 | }); 102 | }, 103 | 104 | 'nativePushString': function(string) 105 | { 106 | nativeState.arguments.push({ 107 | type: 'string', 108 | val: Pointer_stringify(string) 109 | }); 110 | }, 111 | 112 | 'nativePushInt': function(val) 113 | { 114 | nativeState.arguments.push({ 115 | type: 'int', 116 | val: val 117 | }); 118 | }, 119 | 120 | 'nativePushFloat': function(val) 121 | { 122 | nativeState.arguments.push({ 123 | type: 'float', 124 | val: (val === 0) ? val : val + 0.00001 125 | }); 126 | }, 127 | 128 | 'Cfx_WrapMainFunction': function(fn) 129 | { 130 | print('Cfx_WrapMainFunction'); 131 | 132 | setTimeout(function() 133 | { 134 | Runtime.dynCall('v', fn, []); 135 | }, 0); 136 | }, 137 | 138 | 'nativeCallInt': function() 139 | { 140 | return NATIVE.callNative(Citizen.resultAsInteger()); 141 | }, 142 | 143 | 'nativeCallFloat': function() 144 | { 145 | return NATIVE.callNative(Citizen.resultAsFloat()); 146 | }, 147 | 148 | 'nativeCallString': function() 149 | { 150 | 'use strict'; 151 | 152 | let str = NATIVE.callNative(Citizen.resultAsString()); 153 | 154 | if (str === null) 155 | { 156 | return null; 157 | } 158 | 159 | if (typeof window.stringPool === 'undefined') 160 | { 161 | window.stringPool = {}; 162 | } 163 | 164 | if (!(str in window.stringPool)) 165 | { 166 | let buffer = allocate(intArrayFromString(str), 'i8', ALLOC_NORMAL); 167 | 168 | window.stringPool[str] = buffer; 169 | } 170 | 171 | return window.stringPool[str]; 172 | }, 173 | 174 | 'nativeCallVector3': function(pX, pY, pZ) 175 | { 176 | 'use strict'; 177 | 178 | let vector = NATIVE.callNative(Citizen.resultAsVector()); 179 | 180 | setValue(pX, vector[0], 'float'); 181 | setValue(pY, vector[1], 'float'); 182 | setValue(pZ, vector[2], 'float'); 183 | } 184 | }; 185 | 186 | autoAddDeps(library, '$NATIVE'); 187 | mergeInto(LibraryManager.library, library); -------------------------------------------------------------------------------- /Client/Include/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | #define IMPORT __declspec(dllimport) 12 | 13 | /* textures */ 14 | 15 | // Create texture 16 | // texFileName - texture file name, it's best to specify full texture path and use PNG textures 17 | // returns internal texture id 18 | // Texture deletion is performed automatically when game reloads scripts 19 | // Can be called only in the same thread as natives 20 | 21 | IMPORT int createTexture(const char *texFileName); 22 | 23 | // Draw texture 24 | // id - texture id recieved from createTexture() 25 | // index - each texture can have up to 64 different instances on screen at one time 26 | // level - draw level, being used in global draw order, texture instance with least level draws first 27 | // time - how much time (ms) texture instance will stay on screen, the amount of time should be enough 28 | // for it to stay on screen until the next corresponding drawTexture() call 29 | // sizeX,Y - size in screen space, should be in the range from 0.0 to 1.0, e.g setting this to 0.2 means that 30 | // texture instance will take 20% of the screen space 31 | // centerX,Y - center position in texture space, e.g. 0.5 means real texture center 32 | // posX,Y - position in screen space, [0.0, 0.0] - top left corner, [1.0, 1.0] - bottom right, 33 | // texture instance is positioned according to it's center 34 | // rotation - should be in the range from 0.0 to 1.0 35 | // screenHeightScaleFactor - screen aspect ratio, used for texture size correction, you can get it using natives 36 | // r,g,b,a - color, should be in the range from 0.0 to 1.0 37 | // 38 | // Texture instance draw parameters are updated each time script performs corresponding call to drawTexture() 39 | // You should always check your textures layout for 16:9, 16:10 and 4:3 screen aspects, for ex. in 1280x720, 40 | // 1440x900 and 1024x768 screen resolutions, use windowed mode for this 41 | // Can be called only in the same thread as natives 42 | 43 | IMPORT void drawTexture(int id, int index, int level, int time, 44 | float sizeX, float sizeY, float centerX, float centerY, 45 | float posX, float posY, float rotation, float screenHeightScaleFactor, 46 | float r, float g, float b, float a); 47 | 48 | // IDXGISwapChain::Present callback 49 | // Called right before the actual Present method call, render test calls don't trigger callbacks 50 | // When the game uses DX10 it actually uses DX11 with DX10 feature level 51 | // Remember that you can't call natives inside 52 | // void OnPresent(IDXGISwapChain *swapChain); 53 | typedef void(*PresentCallback)(void *); 54 | 55 | // Register IDXGISwapChain::Present callback 56 | // must be called on dll attach 57 | IMPORT void presentCallbackRegister(PresentCallback cb); 58 | 59 | // Unregister IDXGISwapChain::Present callback 60 | // must be called on dll detach 61 | IMPORT void presentCallbackUnregister(PresentCallback cb); 62 | 63 | /* keyboard */ 64 | 65 | // DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow 66 | typedef void(*KeyboardHandler)(DWORD, WORD, BYTE, BOOL, BOOL, BOOL, BOOL); 67 | 68 | // Register keyboard handler 69 | // must be called on dll attach 70 | IMPORT void keyboardHandlerRegister(KeyboardHandler handler); 71 | 72 | // Unregister keyboard handler 73 | // must be called on dll detach 74 | IMPORT void keyboardHandlerUnregister(KeyboardHandler handler); 75 | 76 | /* scripts */ 77 | 78 | IMPORT void scriptWait(DWORD time); 79 | IMPORT void scriptRegister(HMODULE module, void(*LP_SCRIPT_MAIN)()); 80 | IMPORT void scriptRegisterAdditionalThread(HMODULE module, void(*LP_SCRIPT_MAIN)()); 81 | IMPORT void scriptUnregister(HMODULE module); 82 | IMPORT void scriptUnregister(void(*LP_SCRIPT_MAIN)()); // deprecated 83 | 84 | IMPORT void nativeInit(UINT64 hash); 85 | IMPORT void nativePush64(UINT64 val); 86 | IMPORT PUINT64 nativeCall(); 87 | 88 | static void WAIT(DWORD time) { scriptWait(time); } 89 | static void TERMINATE() { WAIT(MAXDWORD); } 90 | 91 | // Returns pointer to global variable 92 | // make sure that you check game version before accessing globals because 93 | // ids may differ between patches 94 | IMPORT UINT64 *getGlobalPtr(int globalId); 95 | 96 | /* world */ 97 | 98 | // Get entities from internal pools 99 | // return value represents filled array elements count 100 | // can be called only in the same thread as natives 101 | IMPORT int worldGetAllVehicles(int *arr, int arrSize); 102 | IMPORT int worldGetAllPeds(int *arr, int arrSize); 103 | IMPORT int worldGetAllObjects(int *arr, int arrSize); 104 | 105 | /* misc */ 106 | 107 | enum eGameVersion : int 108 | { 109 | VER_1_0_335_2_STEAM, 110 | VER_1_0_335_2_NOSTEAM, 111 | 112 | VER_1_0_350_1_STEAM, 113 | VER_1_0_350_2_NOSTEAM, 114 | 115 | VER_1_0_372_2_STEAM, 116 | VER_1_0_372_2_NOSTEAM, 117 | 118 | VER_1_0_393_2_STEAM, 119 | VER_1_0_393_2_NOSTEAM, 120 | 121 | VER_1_0_393_4_STEAM, 122 | VER_1_0_393_4_NOSTEAM, 123 | 124 | VER_SIZE, 125 | VER_UNK = -1 126 | }; 127 | 128 | IMPORT eGameVersion getGameVersion(); 129 | -------------------------------------------------------------------------------- /LambdaMenu/database.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | #include "inc\enums.h" 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #pragma once 26 | 27 | struct FeatureEnabledDBRow 28 | { 29 | char* name; 30 | bool enabled; 31 | }; 32 | 33 | struct StringPairSettingDBRow 34 | { 35 | std::string name; 36 | std::string value; 37 | }; 38 | 39 | class SavedVehicleModDBRow 40 | { 41 | public: 42 | int rowID; 43 | int parentID; 44 | int modID; 45 | int modState; 46 | bool isToggle; 47 | }; 48 | 49 | class SavedVehicleExtraDBRow 50 | { 51 | public: 52 | int rowID; 53 | int parentID; 54 | int extraID; 55 | int extraState; 56 | }; 57 | 58 | class SavedVehicleDBRow 59 | { 60 | public: 61 | 62 | int rowID; 63 | int colourPrimary; 64 | int colourSecondary; 65 | int colourExtraPearl; 66 | int colourExtraWheel; 67 | int colourMod1Type; 68 | int colourMod1Colour; 69 | int colourMod1P3; 70 | int colourMod2Type; 71 | int colourMod2Colour; 72 | int colourCustom1RGB[3]; 73 | int colourCustom2RGB[3]; 74 | int livery; 75 | int plateType; 76 | int wheelType; 77 | int windowTint; 78 | int interiorColor; 79 | int lightColor; 80 | int neonColor[3]; 81 | int smokeColor[3]; 82 | int neonToggle[4]; 83 | std::string saveName; 84 | std::string plateText; 85 | DWORD model; 86 | bool burstableTyres; 87 | bool customTyres; 88 | 89 | std::vector extras; 90 | std::vector mods; 91 | 92 | inline ~SavedVehicleDBRow() 93 | { 94 | for (std::vector::iterator it = extras.begin(); it != extras.end(); ++it) 95 | { 96 | delete (*it); 97 | } 98 | 99 | for (std::vector::iterator it = mods.begin(); it != mods.end(); ++it) 100 | { 101 | delete (*it); 102 | } 103 | } 104 | 105 | inline SavedVehicleDBRow() 106 | { 107 | 108 | } 109 | }; 110 | 111 | class SavedSkinComponentDBRow 112 | { 113 | public: 114 | int rowID; 115 | int parentID; 116 | int slotID; 117 | int drawable; 118 | int texture; 119 | }; 120 | 121 | class SavedSkinPropDBRow 122 | { 123 | public: 124 | int rowID; 125 | int parentID; 126 | int propID; 127 | int drawable; 128 | int texture; 129 | }; 130 | 131 | class SavedSkinDBRow 132 | { 133 | public: 134 | 135 | int rowID; 136 | std::string saveName; 137 | DWORD model; 138 | 139 | std::vector components; 140 | std::vector props; 141 | 142 | inline ~SavedSkinDBRow() 143 | { 144 | for (std::vector::iterator it = components.begin(); it != components.end(); ++it) 145 | { 146 | delete (*it); 147 | } 148 | 149 | for (std::vector::iterator it = props.begin(); it != props.end(); ++it) 150 | { 151 | delete (*it); 152 | } 153 | } 154 | 155 | inline SavedSkinDBRow() 156 | { 157 | 158 | } 159 | }; 160 | 161 | class FeatureEnabledLocalDefinition 162 | { 163 | public: 164 | char* name; 165 | bool* enabled; 166 | bool* updateFlag = NULL; 167 | 168 | inline FeatureEnabledLocalDefinition(char* name, bool* enabled, bool* updateFlag = NULL) 169 | { 170 | this->name = name; 171 | this->enabled = enabled; 172 | this->updateFlag = updateFlag; 173 | }; 174 | }; 175 | 176 | class ERDatabase 177 | { 178 | public: 179 | 180 | virtual ~ERDatabase() {}; 181 | 182 | virtual bool open() = 0; 183 | 184 | virtual void close() = 0; 185 | 186 | virtual void store_feature_enabled_pairs(std::vector values) = 0; 187 | 188 | virtual void load_feature_enabled_pairs(std::vector values) = 0; 189 | 190 | virtual void store_setting_pairs(std::vector values) = 0; 191 | 192 | virtual std::vector load_setting_pairs() = 0; 193 | 194 | virtual bool save_vehicle(Vehicle veh, std::string saveName, int slot = -1) = 0; 195 | 196 | virtual bool save_skin(Ped ped, std::string saveName, int slot = -1) = 0; 197 | 198 | virtual std::vector get_saved_vehicles(int index = -1) = 0; 199 | 200 | virtual std::vector get_saved_skins(int index = -1) = 0; 201 | 202 | virtual void populate_saved_vehicle(SavedVehicleDBRow *entry) = 0; 203 | 204 | virtual void populate_saved_skin(SavedSkinDBRow *entry) = 0; 205 | 206 | virtual void delete_saved_vehicle(int slot) = 0; 207 | 208 | virtual void delete_saved_vehicle_children(int slot) = 0; 209 | 210 | virtual void delete_saved_skin(int slot) = 0; 211 | 212 | virtual void delete_saved_skin_children(int slot) = 0; 213 | 214 | virtual void rename_saved_vehicle(std::string name, int slot) = 0; 215 | 216 | virtual void rename_saved_skin(std::string name, int slot) = 0; 217 | }; 218 | 219 | ERDatabase* create_database(); -------------------------------------------------------------------------------- /LambdaMenu/LambdaMenu.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Source 6 | 7 | 8 | Source 9 | 10 | 11 | Source 12 | 13 | 14 | Source 15 | 16 | 17 | Source 18 | 19 | 20 | Source 21 | 22 | 23 | Source 24 | 25 | 26 | Scripthook 27 | 28 | 29 | Source 30 | 31 | 32 | Source 33 | 34 | 35 | Source 36 | 37 | 38 | Source 39 | 40 | 41 | Source 42 | 43 | 44 | Source 45 | 46 | 47 | Source 48 | 49 | 50 | Source 51 | 52 | 53 | Source 54 | 55 | 56 | Source 57 | 58 | 59 | Libs 60 | 61 | 62 | 63 | 64 | Source 65 | 66 | 67 | Source 68 | 69 | 70 | Source 71 | 72 | 73 | Source 74 | 75 | 76 | Source 77 | 78 | 79 | Source 80 | 81 | 82 | Scripthook 83 | 84 | 85 | Scripthook 86 | 87 | 88 | Source 89 | 90 | 91 | Source 92 | 93 | 94 | Source 95 | 96 | 97 | Source 98 | 99 | 100 | Source 101 | 102 | 103 | Scripthook 104 | 105 | 106 | Source 107 | 108 | 109 | Source 110 | 111 | 112 | Libs 113 | 114 | 115 | Libs 116 | 117 | 118 | Scripthook 119 | 120 | 121 | Scripthook 122 | 123 | 124 | Scripthook 125 | 126 | 127 | 128 | 129 | {5d40e36c-ae09-4260-81f5-8ca0d7ae5aae} 130 | 131 | 132 | {d54cfe99-364a-46aa-8af2-73ea565687db} 133 | 134 | 135 | {80919969-5eb2-463f-b8bc-2e3f9f52fea3} 136 | 137 | 138 | {d0038bdf-8873-4ea2-827a-ddaff8f6d52a} 139 | 140 | 141 | {62b69633-82a4-46f8-9bb7-78be1cec1a82} 142 | 143 | 144 | 145 | 146 | Scripthook 147 | 148 | 149 | 150 | 151 | Config 152 | 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | *.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.pfx 193 | *.publishsettings 194 | node_modules/ 195 | orleans.codegen.cs 196 | 197 | # Since there are multiple workflows, uncomment next line to ignore bower_components 198 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 199 | #bower_components/ 200 | 201 | # RIA/Silverlight projects 202 | Generated_Code/ 203 | 204 | # Backup & report files from converting an old project file 205 | # to a newer Visual Studio version. Backup files are not needed, 206 | # because we have git ;-) 207 | _UpgradeReport_Files/ 208 | Backup*/ 209 | UpgradeLog*.XML 210 | UpgradeLog*.htm 211 | 212 | # SQL Server files 213 | *.mdf 214 | *.ldf 215 | 216 | # Business Intelligence projects 217 | *.rdl.data 218 | *.bim.layout 219 | *.bim_*.settings 220 | 221 | # Microsoft Fakes 222 | FakesAssemblies/ 223 | 224 | # GhostDoc plugin setting file 225 | *.GhostDoc.xml 226 | 227 | # Node.js Tools for Visual Studio 228 | .ntvs_analysis.dat 229 | 230 | # Visual Studio 6 build log 231 | *.plg 232 | 233 | # Visual Studio 6 workspace options file 234 | *.opt 235 | 236 | # Visual Studio LightSwitch build output 237 | **/*.HTMLClient/GeneratedArtifacts 238 | **/*.DesktopClient/GeneratedArtifacts 239 | **/*.DesktopClient/ModelManifest.xml 240 | **/*.Server/GeneratedArtifacts 241 | **/*.Server/ModelManifest.xml 242 | _Pvt_Extensions 243 | 244 | # Paket dependency manager 245 | .paket/paket.exe 246 | paket-files/ 247 | 248 | # FAKE - F# Make 249 | .fake/ 250 | 251 | # JetBrains Rider 252 | .idea/ 253 | *.sln.iml 254 | 255 | # CodeRush 256 | .cr/ 257 | 258 | # our Build/ 259 | Build/ 260 | 261 | tmp/ -------------------------------------------------------------------------------- /LambdaMenu/inc/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015-2016 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | #define IMPORT __declspec(dllimport) 12 | 13 | /* textures */ 14 | 15 | // Create texture 16 | // texFileName - texture file name, it's best to specify full texture path and use PNG textures 17 | // returns internal texture id 18 | // Texture deletion is performed automatically when game reloads scripts 19 | // Can be called only in the same thread as natives 20 | 21 | IMPORT int createTexture(const char *texFileName); 22 | 23 | // Draw texture 24 | // id - texture id recieved from createTexture() 25 | // index - each texture can have up to 64 different instances on screen at one time 26 | // level - draw level, being used in global draw order, texture instance with least level draws first 27 | // time - how much time (ms) texture instance will stay on screen, the amount of time should be enough 28 | // for it to stay on screen until the next corresponding drawTexture() call 29 | // sizeX,Y - size in screen space, should be in the range from 0.0 to 1.0, e.g setting this to 0.2 means that 30 | // texture instance will take 20% of the screen space 31 | // centerX,Y - center position in texture space, e.g. 0.5 means real texture center 32 | // posX,Y - position in screen space, [0.0, 0.0] - top left corner, [1.0, 1.0] - bottom right, 33 | // texture instance is positioned according to it's center 34 | // rotation - should be in the range from 0.0 to 1.0 35 | // screenHeightScaleFactor - screen aspect ratio, used for texture size correction, you can get it using natives 36 | // r,g,b,a - color, should be in the range from 0.0 to 1.0 37 | // 38 | // Texture instance draw parameters are updated each time script performs corresponding call to drawTexture() 39 | // You should always check your textures layout for 16:9, 16:10 and 4:3 screen aspects, for ex. in 1280x720, 40 | // 1440x900 and 1024x768 screen resolutions, use windowed mode for this 41 | // Can be called only in the same thread as natives 42 | 43 | IMPORT void drawTexture(int id, int index, int level, int time, 44 | float sizeX, float sizeY, float centerX, float centerY, 45 | float posX, float posY, float rotation, float screenHeightScaleFactor, 46 | float r, float g, float b, float a); 47 | 48 | // IDXGISwapChain::Present callback 49 | // Called right before the actual Present method call, render test calls don't trigger callbacks 50 | // When the game uses DX10 it actually uses DX11 with DX10 feature level 51 | // Remember that you can't call natives inside 52 | // void OnPresent(IDXGISwapChain *swapChain); 53 | typedef void(*PresentCallback)(void *); 54 | 55 | // Register IDXGISwapChain::Present callback 56 | // must be called on dll attach 57 | IMPORT void presentCallbackRegister(PresentCallback cb); 58 | 59 | // Unregister IDXGISwapChain::Present callback 60 | // must be called on dll detach 61 | IMPORT void presentCallbackUnregister(PresentCallback cb); 62 | 63 | /* keyboard */ 64 | 65 | // DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow 66 | typedef void(*KeyboardHandler)(DWORD, WORD, BYTE, BOOL, BOOL, BOOL, BOOL); 67 | 68 | // Register keyboard handler 69 | // must be called on dll attach 70 | IMPORT void keyboardHandlerRegister(KeyboardHandler handler); 71 | 72 | // Unregister keyboard handler 73 | // must be called on dll detach 74 | IMPORT void keyboardHandlerUnregister(KeyboardHandler handler); 75 | 76 | /* scripts */ 77 | 78 | IMPORT void scriptWait(DWORD time); 79 | IMPORT void scriptRegister(HMODULE module, void(*LP_SCRIPT_MAIN)()); 80 | IMPORT void scriptRegisterAdditionalThread(HMODULE module, void(*LP_SCRIPT_MAIN)()); 81 | IMPORT void scriptUnregister(HMODULE module); 82 | IMPORT void scriptUnregister(void(*LP_SCRIPT_MAIN)()); // deprecated 83 | 84 | IMPORT void nativeInit(UINT64 hash); 85 | IMPORT void nativePush64(UINT64 val); 86 | IMPORT PUINT64 nativeCall(); 87 | 88 | static void WAIT(DWORD time) { scriptWait(time); } 89 | static void TERMINATE() { WAIT(MAXDWORD); } 90 | 91 | // Returns pointer to global variable 92 | // make sure that you check game version before accessing globals because 93 | // ids may differ between patches 94 | IMPORT UINT64 *getGlobalPtr(int globalId); 95 | 96 | /* world */ 97 | 98 | // Get entities from internal pools 99 | // return value represents filled array elements count 100 | // can be called only in the same thread as natives 101 | IMPORT int worldGetAllVehicles(int *arr, int arrSize); 102 | IMPORT int worldGetAllPeds(int *arr, int arrSize); 103 | IMPORT int worldGetAllObjects(int *arr, int arrSize); 104 | IMPORT int worldGetAllPickups(int *arr, int arrSize); 105 | 106 | /* misc */ 107 | 108 | // Returns base object pointer using it's script handle 109 | // make sure that you check game version before accessing object fields because 110 | // offsets may differ between patches 111 | IMPORT BYTE *getScriptHandleBaseAddress(int handle); 112 | 113 | enum eGameVersion : int 114 | { 115 | VER_1_0_335_2_STEAM, 116 | VER_1_0_335_2_NOSTEAM, 117 | 118 | VER_1_0_350_1_STEAM, 119 | VER_1_0_350_2_NOSTEAM, 120 | 121 | VER_1_0_372_2_STEAM, 122 | VER_1_0_372_2_NOSTEAM, 123 | 124 | VER_1_0_393_2_STEAM, 125 | VER_1_0_393_2_NOSTEAM, 126 | 127 | VER_1_0_393_4_STEAM, 128 | VER_1_0_393_4_NOSTEAM, 129 | 130 | VER_1_0_463_1_STEAM, 131 | VER_1_0_463_1_NOSTEAM, 132 | 133 | VER_1_0_505_2_STEAM, 134 | VER_1_0_505_2_NOSTEAM, 135 | 136 | VER_1_0_573_1_STEAM, 137 | VER_1_0_573_1_NOSTEAM, 138 | 139 | VER_1_0_617_1_STEAM, 140 | VER_1_0_617_1_NOSTEAM, 141 | 142 | VER_SIZE, 143 | VER_UNK = -1 144 | }; 145 | 146 | IMPORT eGameVersion getGameVersion(); 147 | -------------------------------------------------------------------------------- /LambdaMenu/config_io.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include "config_io.h" 16 | #include "keyboard.h" 17 | #include "script.h" 18 | #include "debuglog.h" 19 | #include 20 | 21 | // A global Windows "basic string". Actual memory is allocated by the 22 | // COM methods used by MSXML which take &bstr. We must use SysFreeString() 23 | // to free this memory before subsequent uses, to prevent a leak. 24 | BSTR bstr; 25 | 26 | TrainerConfig *config = NULL; 27 | 28 | /**Read the XML config file. Currently contains keyboard choices.*/ 29 | void read_config_file() 30 | { 31 | TrainerConfig *result = new TrainerConfig(); 32 | 33 | CoInitialize(NULL); 34 | 35 | //read XML 36 | MSXML2::IXMLDOMDocumentPtr spXMLDoc; 37 | spXMLDoc.CreateInstance(__uuidof(MSXML2::DOMDocument60)); 38 | if (!spXMLDoc->load("lm-config.xml")) 39 | { 40 | write_text_to_log_file("No config found, using defaults"); 41 | config = result; //the default config 42 | } 43 | 44 | IXMLDOMNodeListPtr nodes = spXMLDoc->selectNodes(L"//lm-config/keys/key"); 45 | 46 | long length; 47 | nodes->get_length(&length); 48 | for (int i = 0; i < length; i++) 49 | { 50 | IXMLDOMNode *node; 51 | nodes->get_item(i, &node); 52 | IXMLDOMNamedNodeMap *attribs; 53 | node->get_attributes(&attribs); 54 | 55 | long length_attribs; 56 | attribs->get_length(&length_attribs); 57 | 58 | char *attrib_key_func = NULL; 59 | char *attrib_key_value = NULL; 60 | 61 | for (long j = 0; j < length_attribs; j++) 62 | { 63 | IXMLDOMNode *attribNode; 64 | attribs->get_item(j, &attribNode); 65 | attribNode->get_nodeName(&bstr); 66 | if (wcscmp(bstr, L"function") == 0) 67 | { 68 | VARIANT var; 69 | VariantInit(&var); 70 | attribNode->get_nodeValue(&var); 71 | attrib_key_func = _com_util::ConvertBSTRToString(V_BSTR(&var)); 72 | } 73 | else if (wcscmp(bstr, L"value") == 0) 74 | { 75 | VARIANT var; 76 | VariantInit(&var); 77 | attribNode->get_nodeValue(&var); 78 | attrib_key_value = _com_util::ConvertBSTRToString(V_BSTR(&var)); 79 | } 80 | SysFreeString(bstr); 81 | attribNode->Release(); 82 | } 83 | 84 | if (attrib_key_func != NULL && attrib_key_value != NULL) 85 | { 86 | result->get_key_config()->set_key(attrib_key_func, attrib_key_value); 87 | } 88 | 89 | delete attrib_key_func; 90 | delete attrib_key_value; 91 | 92 | attribs->Release(); 93 | node->Release(); 94 | } 95 | 96 | //nodes->Release(); //don't do this, it crashes on exit 97 | spXMLDoc.Release(); 98 | CoUninitialize(); 99 | 100 | config = result; 101 | } 102 | 103 | void KeyInputConfig::set_key(char* function, char* keyName) 104 | { 105 | std::ostringstream ss; 106 | ss << "Key function " << function << " being given " << keyName; 107 | write_text_to_log_file(ss.str()); 108 | 109 | int vkID = keyNameToVal(keyName); 110 | if (vkID == -1) 111 | { 112 | ss.str(""); ss.clear(); 113 | ss << "Key function " << keyName << " didn't correspond to a value"; 114 | write_text_to_log_file(ss.str()); 115 | return; 116 | } 117 | 118 | if (strcmp(function, "menu_up") == 0) 119 | { 120 | key_menu_up = vkID; 121 | } 122 | else if (strcmp(function, "menu_down") == 0) 123 | { 124 | key_menu_down = vkID; 125 | } 126 | else if (strcmp(function, "menu_left") == 0) 127 | { 128 | key_menu_left = vkID; 129 | } 130 | else if (strcmp(function, "menu_right") == 0) 131 | { 132 | key_menu_right = vkID; 133 | } 134 | else if (strcmp(function, "menu_select") == 0) 135 | { 136 | key_menu_confirm = vkID; 137 | } 138 | else if (strcmp(function,"menu_back") == 0) 139 | { 140 | key_menu_back = vkID; 141 | } 142 | else if (strcmp(function, "toggle_main_menu") == 0) 143 | { 144 | key_toggle_main_menu = vkID; 145 | } 146 | else if (strcmp(function, "veh_boost") == 0) 147 | { 148 | key_veh_boost = vkID; 149 | } 150 | else if (strcmp(function, "veh_stop") == 0) 151 | { 152 | key_veh_stop = vkID; 153 | } 154 | else if (strcmp(function, "toggle_noclip") == 0) 155 | { 156 | key_toggle_noclip = vkID; 157 | } 158 | else if (strcmp(function, "noclip_up") == 0) 159 | { 160 | key_noclip_up = vkID; 161 | } 162 | else if (strcmp(function, "noclip_down") == 0) 163 | { 164 | key_noclip_down = vkID; 165 | } 166 | else if (strcmp(function, "noclip_forward") == 0) 167 | { 168 | key_noclip_forward = vkID; 169 | } 170 | else if (strcmp(function, "noclip_back") == 0) 171 | { 172 | key_noclip_back = vkID; 173 | } 174 | else if (strcmp(function, "noclip_rotate_left") == 0) 175 | { 176 | key_noclip_rotate_left = vkID; 177 | } 178 | else if (strcmp(function, "noclip_rotate_right") == 0) 179 | { 180 | key_noclip_rotate_right = vkID; 181 | } 182 | else if (strcmp(function, "noclip_speed") == 0) 183 | { 184 | key_noclip_speed = vkID; 185 | } 186 | else if (strcmp(function, "left_signal") == 0) 187 | { 188 | left_signal = vkID; 189 | } 190 | else if (strcmp(function, "right_signal") == 0) 191 | { 192 | right_signal = vkID; 193 | } 194 | else if (strcmp(function, "interior_light") == 0) 195 | { 196 | interior_light = vkID; 197 | } 198 | else if (strcmp(function, "front_windows_up") == 0) 199 | { 200 | front_windows_up = vkID; 201 | } 202 | else if (strcmp(function, "front_windows_down") == 0) 203 | { 204 | front_windows_down = vkID; 205 | } 206 | else if (strcmp(function, "back_windows_up2") == 0) 207 | { 208 | back_windows_up = vkID; 209 | } 210 | else if (strcmp(function, "back_windows_down1") == 0) 211 | { 212 | back_windows_down = vkID; 213 | } 214 | else if (strcmp(function, "no_siren") == 0) 215 | { 216 | no_siren = vkID; 217 | } 218 | else if (strcmp(function, "player_ragdoll") == 0) 219 | { 220 | player_ragdoll = vkID; 221 | } 222 | else if (strcmp(function, "teleport_to_marker") == 0) 223 | { 224 | teleport_to_marker = vkID; 225 | } 226 | else if (strcmp(function, "map_cycle") == 0) 227 | { 228 | map_cycle = vkID; 229 | } 230 | else if (strcmp(function, "push_through_wall") == 0) 231 | { 232 | push_through_wall = vkID; 233 | } 234 | else if (strcmp(function, "pointing_action") == 0) 235 | { 236 | pointing_action = vkID; 237 | } 238 | else if (strcmp(function, "ragdoll_force") == 0) 239 | { 240 | ragdoll_force = vkID; 241 | } 242 | else if (strcmp(function, "drift_mode") == 0) 243 | { 244 | drift_mode = vkID; 245 | } 246 | else if (strcmp(function, "player_names") == 0) 247 | { 248 | player_names = vkID; 249 | } 250 | else if (strcmp(function, "player_names_vehicles") == 0) 251 | { 252 | player_names_vehicles = vkID; 253 | } 254 | else if (strcmp(function, "door_front_left") == 0) 255 | { 256 | door_front_left = vkID; 257 | } 258 | else if (strcmp(function, "door_front_right") == 0) 259 | { 260 | door_front_right = vkID; 261 | } 262 | else if (strcmp(function, "door_back_left") == 0) 263 | { 264 | door_back_left = vkID; 265 | } 266 | else if (strcmp(function, "door_back_right") == 0) 267 | { 268 | door_back_right = vkID; 269 | } 270 | else if (strcmp(function, "hood") == 0) 271 | { 272 | hood = vkID; 273 | } 274 | else if (strcmp(function, "trunk") == 0) 275 | { 276 | trunk = vkID; 277 | } 278 | else if (strcmp(function, "hotkey_modifier_one") == 0) 279 | { 280 | hotkey_modifier_one = vkID; 281 | } 282 | else if (strcmp(function, "hotkey_modifier_two") == 0) 283 | { 284 | hotkey_modifier_two = vkID; 285 | } 286 | else if (strcmp(function, "toggle_editor") == 0) 287 | { 288 | toggle_editor = vkID; 289 | } 290 | else if (strcmp(function, "discard_recording") == 0) 291 | { 292 | discard_recording = vkID; 293 | } 294 | else 295 | { 296 | ss.str(""); ss.clear(); 297 | ss << "Key function " << function << " didn't correspond to a known function"; 298 | write_text_to_log_file(ss.str()); 299 | } 300 | }; 301 | 302 | TrainerConfig::TrainerConfig() 303 | { 304 | this->keyConfig = new KeyInputConfig(); 305 | } -------------------------------------------------------------------------------- /LambdaMenu/keyboard.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | #define VK_KEY_0 0x30 //('0') 0 12 | #define VK_KEY_1 0x31 //('1') 1 13 | #define VK_KEY_2 0x32 //('2') 2 14 | #define VK_KEY_3 0x33 //('3') 3 15 | #define VK_KEY_4 0x34 //('4') 4 16 | #define VK_KEY_5 0x35 //('5') 5 17 | #define VK_KEY_6 0x36 //('6') 6 18 | #define VK_KEY_7 0x37 //('7') 7 19 | #define VK_KEY_8 0x38 //('8') 8 20 | #define VK_KEY_9 0x39 //('9') 9 21 | #define VK_KEY_A 0x41 //('A') A 22 | #define VK_KEY_B 0x42 //('B') B 23 | #define VK_KEY_C 0x43 //('C') C 24 | #define VK_KEY_D 0x44 //('D') D 25 | #define VK_KEY_E 0x45 //('E') E 26 | #define VK_KEY_F 0x46 //('F') F 27 | #define VK_KEY_G 0x47 //('G') G 28 | #define VK_KEY_H 0x48 //('H') H 29 | #define VK_KEY_I 0x49 //('I') I 30 | #define VK_KEY_J 0x4A //('J') J 31 | #define VK_KEY_K 0x4B //('K') K 32 | #define VK_KEY_L 0x4C //('L') L 33 | #define VK_KEY_M 0x4D //('M') M 34 | #define VK_KEY_N 0x4E //('N') N 35 | #define VK_KEY_O 0x4F //('O') O 36 | #define VK_KEY_P 0x50 //('P') P 37 | #define VK_KEY_Q 0x51 //('Q') Q 38 | #define VK_KEY_R 0x52 //('R') R 39 | #define VK_KEY_S 0x53 //('S') S 40 | #define VK_KEY_T 0x54 //('T') T 41 | #define VK_KEY_U 0x55 //('U') U 42 | #define VK_KEY_V 0x56 //('V') V 43 | #define VK_KEY_W 0x57 //('W') W 44 | #define VK_KEY_X 0x58 //('X') X 45 | #define VK_KEY_Y 0x59 //('Y') Y 46 | #define VK_KEY_Z 0x5A //('Z') Z 47 | 48 | // parameters are the same as with aru's ScriptHook for IV 49 | void OnKeyboardMessage(DWORD key, WORD repeats, BYTE scanCode, BOOL isExtended, BOOL isWithAlt, BOOL wasDownBefore, BOOL isUpNow); 50 | 51 | bool IsKeyDown(DWORD key); 52 | bool IsKeyJustUp(DWORD key, bool exclusive = true); 53 | void ResetKeyState(DWORD key); 54 | 55 | struct VirtualKeysWithNames 56 | { 57 | int keyCode; 58 | char* name; 59 | }; 60 | 61 | static const VirtualKeysWithNames ALL_KEYS[] = 62 | { 63 | { VK_KEY_0, "VK_KEY_0" }, 64 | { VK_KEY_1, "VK_KEY_1" }, 65 | { VK_KEY_2, "VK_KEY_2" }, 66 | { VK_KEY_3, "VK_KEY_3" }, 67 | { VK_KEY_4, "VK_KEY_4" }, 68 | { VK_KEY_5, "VK_KEY_5" }, 69 | { VK_KEY_6, "VK_KEY_6" }, 70 | { VK_KEY_7, "VK_KEY_7" }, 71 | { VK_KEY_8, "VK_KEY_8" }, 72 | { VK_KEY_9, "VK_KEY_9" }, 73 | { VK_KEY_A, "VK_KEY_A" }, 74 | { VK_KEY_B, "VK_KEY_B" }, 75 | { VK_KEY_C, "VK_KEY_C" }, 76 | { VK_KEY_D, "VK_KEY_D" }, 77 | { VK_KEY_E, "VK_KEY_E" }, 78 | { VK_KEY_F, "VK_KEY_F" }, 79 | { VK_KEY_G, "VK_KEY_G" }, 80 | { VK_KEY_H, "VK_KEY_H" }, 81 | { VK_KEY_I, "VK_KEY_I" }, 82 | { VK_KEY_J, "VK_KEY_J" }, 83 | { VK_KEY_K, "VK_KEY_K" }, 84 | { VK_KEY_L, "VK_KEY_L" }, 85 | { VK_KEY_M, "VK_KEY_M" }, 86 | { VK_KEY_N, "VK_KEY_N" }, 87 | { VK_KEY_O, "VK_KEY_O" }, 88 | { VK_KEY_P, "VK_KEY_P" }, 89 | { VK_KEY_Q, "VK_KEY_Q" }, 90 | { VK_KEY_R, "VK_KEY_R" }, 91 | { VK_KEY_S, "VK_KEY_S" }, 92 | { VK_KEY_T, "VK_KEY_T" }, 93 | { VK_KEY_U, "VK_KEY_U" }, 94 | { VK_KEY_V, "VK_KEY_V" }, 95 | { VK_KEY_W, "VK_KEY_W" }, 96 | { VK_KEY_X, "VK_KEY_X" }, 97 | { VK_KEY_Y, "VK_KEY_Y" }, 98 | { VK_KEY_Z, "VK_KEY_Z" }, 99 | 100 | { VK_BACK, "VK_BACK" }, 101 | { VK_TAB, "VK_TAB" }, 102 | { VK_CLEAR, "VK_CLEAR" }, 103 | { VK_RETURN, "VK_RETURN" }, 104 | { VK_SHIFT, "VK_SHIFT" }, 105 | { VK_CONTROL, "VK_CONTROL" }, 106 | { VK_MENU, "VK_MENU" }, 107 | { VK_PAUSE, "VK_PAUSE" }, 108 | { VK_CAPITAL, "VK_CAPITAL" }, 109 | { VK_KANA, "VK_KANA" }, 110 | { VK_HANGEUL, "VK_HANGEUL" }, 111 | { VK_HANGUL, "VK_HANGUL" }, 112 | { VK_JUNJA, "VK_JUNJA" }, 113 | { VK_FINAL, "VK_FINAL" }, 114 | { VK_HANJA, "VK_HANJA" }, 115 | { VK_KANJI, "VK_KANJI" }, 116 | { VK_ESCAPE, "VK_ESCAPE" }, 117 | { VK_CONVERT, "VK_CONVERT" }, 118 | { VK_NONCONVERT, "VK_NONCONVERT" }, 119 | { VK_ACCEPT, "VK_ACCEPT" }, 120 | { VK_MODECHANGE, "VK_MODECHANGE" }, 121 | { VK_SPACE, "VK_SPACE" }, 122 | { VK_PRIOR, "VK_PRIOR" }, 123 | { VK_NEXT, "VK_NEXT" }, 124 | { VK_END, "VK_END" }, 125 | { VK_HOME, "VK_HOME" }, 126 | { VK_LEFT, "VK_LEFT" }, 127 | { VK_UP, "VK_UP" }, 128 | { VK_RIGHT, "VK_RIGHT" }, 129 | { VK_DOWN, "VK_DOWN" }, 130 | { VK_SELECT, "VK_SELECT" }, 131 | { VK_PRINT, "VK_PRINT" }, 132 | { VK_EXECUTE, "VK_EXECUTE" }, 133 | { VK_SNAPSHOT, "VK_SNAPSHOT" }, 134 | { VK_INSERT, "VK_INSERT" }, 135 | { VK_DELETE, "VK_DELETE" }, 136 | { VK_HELP, "VK_HELP" }, 137 | { VK_LWIN, "VK_LWIN" }, 138 | { VK_RWIN, "VK_RWIN" }, 139 | { VK_APPS, "VK_APPS" }, 140 | { VK_SLEEP, "VK_SLEEP" }, 141 | { VK_NUMPAD0, "VK_NUMPAD0" }, 142 | { VK_NUMPAD1, "VK_NUMPAD1" }, 143 | { VK_NUMPAD2, "VK_NUMPAD2" }, 144 | { VK_NUMPAD3, "VK_NUMPAD3" }, 145 | { VK_NUMPAD4, "VK_NUMPAD4" }, 146 | { VK_NUMPAD5, "VK_NUMPAD5" }, 147 | { VK_NUMPAD6, "VK_NUMPAD6" }, 148 | { VK_NUMPAD7, "VK_NUMPAD7" }, 149 | { VK_NUMPAD8, "VK_NUMPAD8" }, 150 | { VK_NUMPAD9, "VK_NUMPAD9" }, 151 | { VK_MULTIPLY, "VK_MULTIPLY" }, 152 | { VK_ADD, "VK_ADD" }, 153 | { VK_SEPARATOR, "VK_SEPARATOR" }, 154 | { VK_SUBTRACT, "VK_SUBTRACT" }, 155 | { VK_DECIMAL, "VK_DECIMAL" }, 156 | { VK_DIVIDE, "VK_DIVIDE" }, 157 | { VK_F1, "VK_F1" }, 158 | { VK_F2, "VK_F2" }, 159 | { VK_F3, "VK_F3" }, 160 | { VK_F4, "VK_F4" }, 161 | { VK_F5, "VK_F5" }, 162 | { VK_F6, "VK_F6" }, 163 | { VK_F7, "VK_F7" }, 164 | { VK_F8, "VK_F8" }, 165 | { VK_F9, "VK_F9" }, 166 | { VK_F10, "VK_F10" }, 167 | { VK_F11, "VK_F11" }, 168 | { VK_F12, "VK_F12" }, 169 | { VK_F13, "VK_F13" }, 170 | { VK_F14, "VK_F14" }, 171 | { VK_F15, "VK_F15" }, 172 | { VK_F16, "VK_F16" }, 173 | { VK_F17, "VK_F17" }, 174 | { VK_F18, "VK_F18" }, 175 | { VK_F19, "VK_F19" }, 176 | { VK_F20, "VK_F20" }, 177 | { VK_F21, "VK_F21" }, 178 | { VK_F22, "VK_F22" }, 179 | { VK_F23, "VK_F23" }, 180 | { VK_F24, "VK_F24" }, 181 | { VK_NUMLOCK, "VK_NUMLOCK" }, 182 | { VK_SCROLL, "VK_SCROLL" }, 183 | { VK_OEM_NEC_EQUAL, "VK_OEM_NEC_EQUAL" }, 184 | { VK_OEM_FJ_JISHO, "VK_OEM_FJ_JISHO" }, 185 | { VK_OEM_FJ_MASSHOU, "VK_OEM_FJ_MASSHOU" }, 186 | { VK_OEM_FJ_TOUROKU, "VK_OEM_FJ_TOUROKU" }, 187 | { VK_OEM_FJ_LOYA, "VK_OEM_FJ_LOYA" }, 188 | { VK_OEM_FJ_ROYA, "VK_OEM_FJ_ROYA" }, 189 | { VK_LSHIFT, "VK_LSHIFT" }, 190 | { VK_RSHIFT, "VK_RSHIFT" }, 191 | { VK_LCONTROL, "VK_LCONTROL" }, 192 | { VK_RCONTROL, "VK_RCONTROL" }, 193 | { VK_LMENU, "VK_LMENU" }, 194 | { VK_RMENU, "VK_RMENU" }, 195 | { VK_BROWSER_BACK, "VK_BROWSER_BACK" }, 196 | { VK_BROWSER_FORWARD, "VK_BROWSER_FORWARD" }, 197 | { VK_BROWSER_REFRESH, "VK_BROWSER_REFRESH" }, 198 | { VK_BROWSER_STOP, "VK_BROWSER_STOP" }, 199 | { VK_BROWSER_SEARCH, "VK_BROWSER_SEARCH" }, 200 | { VK_BROWSER_FAVORITES, "VK_BROWSER_FAVORITES" }, 201 | { VK_BROWSER_HOME, "VK_BROWSER_HOME" }, 202 | { VK_VOLUME_MUTE, "VK_VOLUME_MUTE" }, 203 | { VK_VOLUME_DOWN, "VK_VOLUME_DOWN" }, 204 | { VK_VOLUME_UP, "VK_VOLUME_UP" }, 205 | { VK_MEDIA_NEXT_TRACK, "VK_MEDIA_NEXT_TRACK" }, 206 | { VK_MEDIA_PREV_TRACK, "VK_MEDIA_PREV_TRACK" }, 207 | { VK_MEDIA_STOP, "VK_MEDIA_STOP" }, 208 | { VK_MEDIA_PLAY_PAUSE, "VK_MEDIA_PLAY_PAUSE" }, 209 | { VK_LAUNCH_MAIL, "VK_LAUNCH_MAIL" }, 210 | { VK_LAUNCH_MEDIA_SELECT, "VK_LAUNCH_MEDIA_SELECT" }, 211 | { VK_LAUNCH_APP1, "VK_LAUNCH_APP1" }, 212 | { VK_LAUNCH_APP2, "VK_LAUNCH_APP2" }, 213 | { VK_OEM_1, "VK_OEM_1" }, // ; or : 214 | { VK_OEM_PLUS, "VK_OEM_PLUS" }, 215 | { VK_OEM_COMMA, "VK_OEM_COMMA" }, 216 | { VK_OEM_MINUS, "VK_OEM_MINUS" }, 217 | { VK_OEM_PERIOD, "VK_OEM_PERIOD" }, 218 | { VK_OEM_2, "VK_OEM_2" }, 219 | { VK_OEM_3, "VK_OEM_3" }, 220 | { VK_OEM_4, "VK_OEM_4" }, 221 | { VK_OEM_5, "VK_OEM_5" }, 222 | { VK_OEM_6, "VK_OEM_6" }, 223 | { VK_OEM_7, "VK_OEM_7" }, 224 | { VK_OEM_8, "VK_OEM_8" }, 225 | { VK_OEM_AX, "VK_OEM_AX" }, 226 | { VK_OEM_102, "VK_OEM_102" }, 227 | { VK_ICO_HELP, "VK_ICO_HELP" }, 228 | { VK_ICO_00, "VK_ICO_00" }, 229 | { VK_PROCESSKEY, "VK_PROCESSKEY" }, 230 | { VK_ICO_CLEAR, "VK_ICO_CLEAR" }, 231 | { VK_PACKET, "VK_PACKET" }, 232 | 233 | { VK_OEM_RESET, "VK_OEM_RESET" }, 234 | { VK_OEM_JUMP, "VK_OEM_JUMP" }, 235 | { VK_OEM_PA1, "VK_OEM_PA1" }, 236 | { VK_OEM_PA2, "VK_OEM_PA2" }, 237 | { VK_OEM_PA3, "VK_OEM_PA3" }, 238 | { VK_OEM_WSCTRL, "VK_OEM_WSCTRL" }, 239 | { VK_OEM_CUSEL, "VK_OEM_CUSEL" }, 240 | { VK_OEM_ATTN, "VK_OEM_ATTN" }, 241 | { VK_OEM_FINISH, "VK_OEM_FINISH" }, 242 | { VK_OEM_COPY, "VK_OEM_COPY" }, 243 | { VK_OEM_AUTO, "VK_OEM_AUTO" }, 244 | { VK_OEM_ENLW, "VK_OEM_ENLW" }, 245 | { VK_OEM_BACKTAB, "VK_OEM_BACKTAB" }, 246 | { VK_ATTN, "VK_ATTN" }, 247 | { VK_CRSEL, "VK_CRSEL" }, 248 | { VK_EXSEL, "VK_EXSEL" }, 249 | { VK_EREOF, "VK_EREOF" }, 250 | { VK_PLAY, "VK_PLAY" }, 251 | { VK_ZOOM, "VK_ZOOM" }, 252 | { VK_NONAME, "VK_NONAME" }, 253 | { VK_PA1, "VK_PA1" }, 254 | { VK_OEM_CLEAR, "VK_OEM_CLEAR" } 255 | }; 256 | 257 | int keyNameToVal(char * input); -------------------------------------------------------------------------------- /Server/emscripten.lua: -------------------------------------------------------------------------------- 1 | --- 2 | -- gcc.lua 3 | -- Provides GCC-specific configuration strings. 4 | -- Copyright (c) 2002-2015 Jason Perkins and the Premake project 5 | --- 6 | 7 | local p = premake 8 | 9 | p.tools.emscripten = {} 10 | local gcc = p.tools.emscripten 11 | 12 | local project = p.project 13 | local config = p.config 14 | 15 | 16 | -- 17 | -- Returns list of C preprocessor flags for a configuration. 18 | -- 19 | 20 | gcc.cppflags = { 21 | system = { 22 | haiku = "-MMD", 23 | wii = { "-MMD", "-MP", "-I$(LIBOGC_INC)", "$(MACHDEP)" }, 24 | _ = { "-MMD", "-MP" } 25 | } 26 | } 27 | 28 | function gcc.getcppflags(cfg) 29 | local flags = config.mapFlags(cfg, gcc.cppflags) 30 | return flags 31 | end 32 | 33 | 34 | -- 35 | -- Returns list of C compiler flags for a configuration. 36 | -- 37 | 38 | gcc.cflags = { 39 | architecture = { 40 | x86 = "-m32", 41 | x86_64 = "-m64", 42 | }, 43 | flags = { 44 | FatalCompileWarnings = "-Werror", 45 | LinkTimeOptimization = "-flto", 46 | NoFramePointer = "-fomit-frame-pointer", 47 | ShadowedVariables = "-Wshadow", 48 | Symbols = "-g", 49 | UndefinedIdentifiers = "-Wundef", 50 | }, 51 | floatingpoint = { 52 | Fast = "-ffast-math", 53 | Strict = "-ffloat-store", 54 | }, 55 | strictaliasing = { 56 | Off = "-fno-strict-aliasing", 57 | Level1 = { "-fstrict-aliasing", "-Wstrict-aliasing=1" }, 58 | Level2 = { "-fstrict-aliasing", "-Wstrict-aliasing=2" }, 59 | Level3 = { "-fstrict-aliasing", "-Wstrict-aliasing=3" }, 60 | }, 61 | optimize = { 62 | Off = "-O0", 63 | On = "-O2", 64 | Debug = "-Og", 65 | Full = "-O3", 66 | Size = "-Os", 67 | Speed = "-O3", 68 | }, 69 | pic = { 70 | On = "-fPIC", 71 | }, 72 | vectorextensions = { 73 | AVX = "-mavx", 74 | AVX2 = "-mavx2", 75 | SSE = "-msse", 76 | SSE2 = "-msse2", 77 | SSE3 = "-msse3", 78 | SSSE3 = "-mssse3", 79 | ["SSE4.1"] = "-msse4.1", 80 | }, 81 | warnings = { 82 | Extra = "-Wall -Wextra", 83 | Off = "-w", 84 | } 85 | } 86 | 87 | function gcc.getcflags(cfg) 88 | local flags = config.mapFlags(cfg, gcc.cflags) 89 | flags = table.join(flags, gcc.getwarnings(cfg)) 90 | return flags 91 | end 92 | 93 | function gcc.getwarnings(cfg) 94 | local result = {} 95 | for _, enable in ipairs(cfg.enablewarnings) do 96 | table.insert(result, '-W' .. enable) 97 | end 98 | for _, disable in ipairs(cfg.disablewarnings) do 99 | table.insert(result, '-Wno-' .. disable) 100 | end 101 | for _, fatal in ipairs(cfg.fatalwarnings) do 102 | table.insert(result, '-Werror=' .. fatal) 103 | end 104 | return result 105 | end 106 | 107 | 108 | -- 109 | -- Returns list of C++ compiler flags for a configuration. 110 | -- 111 | 112 | gcc.cxxflags = { 113 | exceptionhandling = { 114 | Off = "-fno-exceptions" 115 | }, 116 | flags = { 117 | NoBufferSecurityCheck = "-fno-stack-protector", 118 | ["C++11"] = "-std=c++11", 119 | ["C++14"] = "-std=c++14", 120 | }, 121 | rtti = { 122 | Off = "-fno-rtti" 123 | } 124 | } 125 | 126 | function gcc.getcxxflags(cfg) 127 | local flags = config.mapFlags(cfg, gcc.cxxflags) 128 | return flags 129 | end 130 | 131 | 132 | -- 133 | -- Decorate defines for the GCC command line. 134 | -- 135 | 136 | function gcc.getdefines(defines) 137 | local result = {} 138 | for _, define in ipairs(defines) do 139 | table.insert(result, '-D' .. define) 140 | end 141 | return result 142 | end 143 | 144 | function gcc.getundefines(undefines) 145 | local result = {} 146 | for _, undefine in ipairs(undefines) do 147 | table.insert(result, '-U' .. undefine) 148 | end 149 | return result 150 | end 151 | 152 | 153 | -- 154 | -- Returns a list of forced include files, decorated for the compiler 155 | -- command line. 156 | -- 157 | -- @param cfg 158 | -- The project configuration. 159 | -- @return 160 | -- An array of force include files with the appropriate flags. 161 | -- 162 | 163 | function gcc.getforceincludes(cfg) 164 | local result = {} 165 | 166 | table.foreachi(cfg.forceincludes, function(value) 167 | local fn = project.getrelative(cfg.project, value) 168 | table.insert(result, string.format('-include %s', premake.quoted(fn))) 169 | end) 170 | 171 | return result 172 | end 173 | 174 | 175 | -- 176 | -- Decorate include file search paths for the GCC command line. 177 | -- 178 | 179 | function gcc.getincludedirs(cfg, dirs, sysdirs) 180 | local result = {} 181 | for _, dir in ipairs(dirs) do 182 | dir = project.getrelative(cfg.project, dir) 183 | table.insert(result, '-I' .. premake.quoted(dir)) 184 | end 185 | for _, dir in ipairs(sysdirs or {}) do 186 | dir = project.getrelative(cfg.project, dir) 187 | table.insert(result, '-isystem ' .. premake.quoted(dir)) 188 | end 189 | return result 190 | end 191 | 192 | 193 | -- 194 | -- Return a list of LDFLAGS for a specific configuration. 195 | -- 196 | 197 | gcc.ldflags = { 198 | architecture = { 199 | x86 = "-m32", 200 | x86_64 = "-m64", 201 | }, 202 | flags = { 203 | LinkTimeOptimization = "-flto", 204 | _Symbols = function(cfg) 205 | -- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html 206 | return iif(cfg.system == premake.MACOSX, "-Wl,-x", "-s") 207 | end, 208 | }, 209 | kind = { 210 | SharedLib = function(cfg) 211 | local r = { iif(cfg.system == premake.MACOSX, "-dynamiclib", "-shared") } 212 | if cfg.system == "windows" and not cfg.flags.NoImportLib then 213 | table.insert(r, '-Wl,--out-implib="' .. cfg.linktarget.relpath .. '"') 214 | end 215 | return r 216 | end, 217 | WindowedApp = function(cfg) 218 | if cfg.system == premake.WINDOWS then return "-mwindows" end 219 | end, 220 | }, 221 | system = { 222 | wii = "$(MACHDEP)", 223 | } 224 | } 225 | 226 | function gcc.getldflags(cfg) 227 | local flags = config.mapFlags(cfg, gcc.ldflags) 228 | return flags 229 | end 230 | 231 | 232 | 233 | -- 234 | -- Return a list of decorated additional libraries directories. 235 | -- 236 | 237 | gcc.libraryDirectories = { 238 | architecture = { 239 | x86 = "-L/usr/lib32", 240 | x86_64 = "-L/usr/lib64", 241 | }, 242 | system = { 243 | wii = "-L$(LIBOGC_LIB)", 244 | } 245 | } 246 | 247 | function gcc.getLibraryDirectories(cfg) 248 | local flags = config.mapFlags(cfg, gcc.libraryDirectories) 249 | 250 | -- Scan the list of linked libraries. If any are referenced with 251 | -- paths, add those to the list of library search paths. The call 252 | -- config.getlinks() all includes cfg.libdirs. 253 | for _, dir in ipairs(config.getlinks(cfg, "system", "directory")) do 254 | table.insert(flags, '-L' .. premake.quoted(dir)) 255 | end 256 | 257 | if cfg.flags.RelativeLinks then 258 | for _, dir in ipairs(config.getlinks(cfg, "siblings", "directory")) do 259 | local libFlag = "-L" .. premake.project.getrelative(cfg.project, dir) 260 | if not table.contains(flags, libFlag) then 261 | table.insert(flags, libFlag) 262 | end 263 | end 264 | end 265 | 266 | for _, dir in ipairs(cfg.syslibdirs) do 267 | table.insert(flags, '-L' .. premake.quoted(dir)) 268 | end 269 | 270 | return flags 271 | end 272 | 273 | 274 | 275 | -- 276 | -- Return the list of libraries to link, decorated with flags as needed. 277 | -- 278 | 279 | function gcc.getlinks(cfg, systemonly) 280 | local result = {} 281 | 282 | if not systemonly then 283 | if cfg.flags.RelativeLinks then 284 | local libFiles = config.getlinks(cfg, "siblings", "basename") 285 | for _, link in ipairs(libFiles) do 286 | if string.find(link, "lib") == 1 then 287 | link = link:sub(4) 288 | end 289 | table.insert(result, "-l" .. link) 290 | end 291 | else 292 | -- Don't use the -l form for sibling libraries, since they may have 293 | -- custom prefixes or extensions that will confuse the linker. Instead 294 | -- just list out the full relative path to the library. 295 | result = config.getlinks(cfg, "siblings", "fullpath") 296 | end 297 | end 298 | 299 | -- The "-l" flag is fine for system libraries 300 | 301 | local links = config.getlinks(cfg, "system", "fullpath") 302 | for _, link in ipairs(links) do 303 | if path.isframework(link) then 304 | table.insert(result, "-framework " .. path.getbasename(link)) 305 | elseif path.isobjectfile(link) then 306 | table.insert(result, link) 307 | else 308 | table.insert(result, "-l" .. path.getname(link)) 309 | end 310 | end 311 | 312 | return result 313 | end 314 | 315 | 316 | -- 317 | -- Returns makefile-specific configuration rules. 318 | -- 319 | 320 | gcc.makesettings = { 321 | system = { 322 | wii = [[ 323 | ifeq ($(strip $(DEVKITPPC)),) 324 | $(error "DEVKITPPC environment variable is not set")' 325 | endif 326 | include $(DEVKITPPC)/wii_rules']] 327 | } 328 | } 329 | 330 | function gcc.getmakesettings(cfg) 331 | local settings = config.mapFlags(cfg, gcc.makesettings) 332 | return table.concat(settings) 333 | end 334 | 335 | 336 | -- 337 | -- Retrieves the executable command name for a tool, based on the 338 | -- provided configuration and the operating environment. 339 | -- 340 | -- @param cfg 341 | -- The configuration to query. 342 | -- @param tool 343 | -- The tool to fetch, one of "cc" for the C compiler, "cxx" for 344 | -- the C++ compiler, or "ar" for the static linker. 345 | -- @return 346 | -- The executable command name for a tool, or nil if the system's 347 | -- default value should be used. 348 | -- 349 | 350 | gcc.tools = { 351 | cc = "emcc", 352 | cxx = "em++", 353 | ar = "emar", 354 | rc = "windres" 355 | } 356 | 357 | function gcc.gettoolname(cfg, tool) 358 | if (cfg.gccprefix and gcc.tools[tool]) or tool == "rc" then 359 | return (cfg.gccprefix or "") .. gcc.tools[tool] 360 | end 361 | return nil 362 | end 363 | 364 | -------------------------------------------------------------------------------- /LambdaMenu/menu_functions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include "menu_functions.h" 16 | #include "script.h" 17 | #include "colors.h" 18 | 19 | std::string centreScreenStatusText; 20 | DWORD centreScreenStatusTextDrawTicksMax; 21 | bool centreScreenStatusTextGxtEntry; 22 | 23 | bool menu_showing = false; 24 | 25 | void(*periodic_feature_call)(void) = NULL; 26 | 27 | void set_periodic_feature_call(void method(void)) 28 | { 29 | periodic_feature_call = method; 30 | } 31 | 32 | void make_periodic_feature_call() 33 | { 34 | periodic_feature_call(); 35 | } 36 | 37 | void set_menu_showing(bool showing) 38 | { 39 | menu_showing = showing; 40 | } 41 | 42 | bool is_menu_showing() 43 | { 44 | return menu_showing; 45 | } 46 | 47 | void draw_menu_line(std::string caption, float lineWidth, float lineHeight, float lineTop, float lineLeft, float textLeft, bool active, bool title, bool rescaleText) 48 | { 49 | // default values 50 | int text_col[4] = { 255, 255, 255, 255 }, 51 | rect_col[4] = { 255, 255, 255, 80 }; 52 | float text_scale = 0.35; 53 | int font = 0; 54 | bool outline = false; 55 | bool dropShadow = false; 56 | 57 | // correcting values for active line 58 | if (active) 59 | { 60 | text_col[0] = 255; 61 | text_col[1] = 255; 62 | text_col[2] = 255; 63 | 64 | //rect_col[0] = 102; 65 | //rect_col[1] = 153; 66 | //rect_col[2] = 255; 67 | rect_col[0] = menuColor_RGB[0]; 68 | rect_col[1] = menuColor_RGB[1]; 69 | rect_col[2] = menuColor_RGB[2]; 70 | rect_col[3] = 200; 71 | 72 | 73 | if (rescaleText) text_scale = 0.40; 74 | } 75 | else if (title) 76 | { 77 | text_col[0] = 255; 78 | text_col[1] = 255; 79 | text_col[2] = 255; 80 | 81 | rect_col[0] = 0; 82 | rect_col[1] = 0; 83 | rect_col[2] = 0; 84 | rect_col[3] = 200; 85 | 86 | if (rescaleText) 87 | { 88 | text_scale = 0.60; 89 | } 90 | font = 2; 91 | } 92 | else 93 | { 94 | outline = true; 95 | } 96 | 97 | int screen_w, screen_h; 98 | GRAPHICS::GET_SCREEN_RESOLUTION(&screen_w, &screen_h); 99 | 100 | textLeft += lineLeft; 101 | 102 | float lineWidthScaled = lineWidth / (float)screen_w; // line width 103 | float lineTopScaled = lineTop / (float)screen_h; // line top offset 104 | float textLeftScaled = textLeft / (float)screen_w; // text left offset 105 | float lineHeightScaled = lineHeight / (float)screen_h; // line height 106 | 107 | float lineLeftScaled = lineLeft / (float)screen_w; 108 | 109 | float textHeightScaled = (title ? TEXT_HEIGHT_TITLE : TEXT_HEIGHT_NORMAL) / (float)screen_h; 110 | 111 | // this is how it's done in original scripts 112 | 113 | // text upper part 114 | UI::SET_TEXT_FONT(font); 115 | UI::SET_TEXT_SCALE(0.0, text_scale); 116 | UI::SET_TEXT_COLOUR(text_col[0], text_col[1], text_col[2], text_col[3]); 117 | UI::SET_TEXT_CENTRE(0); 118 | 119 | if (outline) 120 | { 121 | UI::SET_TEXT_OUTLINE(); 122 | } 123 | 124 | if (dropShadow) 125 | { 126 | UI::SET_TEXT_DROPSHADOW(5, 0, 78, 255, 255); //5 127 | } 128 | 129 | UI::SET_TEXT_EDGE(0, 0, 0, 0, 0); 130 | UI::_SET_TEXT_ENTRY("STRING"); 131 | UI::_ADD_TEXT_COMPONENT_STRING((LPSTR)caption.c_str()); 132 | 133 | UI::_DRAW_TEXT(textLeftScaled, lineTopScaled + (0.5f * (lineHeightScaled - textHeightScaled))); 134 | 135 | // rect 136 | draw_rect(lineLeftScaled, lineTopScaled, 137 | lineWidthScaled, lineHeightScaled, 138 | rect_col[0], rect_col[1], rect_col[2], rect_col[3]); 139 | } 140 | 141 | void draw_rect(float A_0, float A_1, float A_2, float A_3, int A_4, int A_5, int A_6, int A_7) 142 | { 143 | //this craziness is required - X and Y are strange 144 | GRAPHICS::DRAW_RECT((A_0 + (A_2 * 0.5f)), (A_1 + (A_3 * 0.5f)), A_2, A_3, A_4, A_5, A_6, A_7); 145 | } 146 | 147 | void set_status_text(std::string str, bool isGxtEntry) 148 | { 149 | UI::_SET_NOTIFICATION_TEXT_ENTRY(const_cast(isGxtEntry ? &str[0u] : "STRING")); 150 | UI::_ADD_TEXT_COMPONENT_STRING(&str[0u]); 151 | UI::_DRAW_NOTIFICATION(FALSE, FALSE); // _DRAW_NOTIFICATION(BOOL blink, BOOL p1) 152 | } 153 | 154 | 155 | 156 | void set_status_text_centre_screen(std::string str, DWORD time, bool isGxtEntry) 157 | { 158 | centreScreenStatusText = str; 159 | centreScreenStatusTextDrawTicksMax = GetTickCount() + time; 160 | centreScreenStatusTextGxtEntry = isGxtEntry; 161 | } 162 | 163 | void update_centre_screen_status_text() 164 | { 165 | if (GetTickCount() < centreScreenStatusTextDrawTicksMax) 166 | { 167 | UI::SET_TEXT_FONT(4); //4 168 | UI::SET_TEXT_SCALE(0.5, 0.5); 169 | UI::SET_TEXT_COLOUR(255, 255, 255, 255); 170 | UI::SET_TEXT_WRAP(0.0, 1.0); 171 | UI::SET_TEXT_CENTRE(1); 172 | UI::SET_TEXT_OUTLINE(); 173 | UI::SET_TEXT_DROPSHADOW(1, 0, 78, 255, 255); //4 174 | UI::SET_TEXT_EDGE(1, 0, 0, 0, 205); 175 | if (centreScreenStatusTextGxtEntry) 176 | { 177 | UI::_SET_TEXT_ENTRY((char *)centreScreenStatusText.c_str()); 178 | } 179 | else 180 | { 181 | UI::_SET_TEXT_ENTRY("STRING"); 182 | UI::_ADD_TEXT_COMPONENT_STRING((char *)centreScreenStatusText.c_str()); 183 | } 184 | UI::_DRAW_TEXT(0.5, 0); 185 | } 186 | } 187 | 188 | void menu_beep() 189 | { 190 | AUDIO::PLAY_SOUND_FRONTEND(-1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0); 191 | } 192 | 193 | void draw_menu_from_struct_def(StandardOrToggleMenuDef defs[], int lineCount, int* selectionRef, std::string caption, bool(*onConfirmation)(MenuItem value)) 194 | { 195 | MenuItemVector menuItems; 196 | for (int i = 0; i < lineCount; i++) 197 | { 198 | if (defs[i].pState != NULL) 199 | { 200 | ToggleMenuItem item; 201 | item.caption = defs[i].text; 202 | item.value = i; 203 | item.toggleValue = defs[i].pState; 204 | item.isLeaf = false; 205 | if (defs[i].pUpdated != NULL) 206 | { 207 | item.toggleValueUpdated = defs[i].pUpdated; 208 | } 209 | menuItems.push_back(item); 210 | } 211 | else if (defs[i].itemType != NULL && defs[i].itemType == WANTED) 212 | { 213 | WantedSymbolItem item; 214 | item.caption = defs[i].text; 215 | item.value = i; 216 | menuItems.push_back(item); 217 | } 218 | else 219 | { 220 | MenuItem item; 221 | item.caption = defs[i].text; 222 | item.value = i; 223 | item.isLeaf = defs[i].isLeaf; 224 | menuItems.push_back(item); 225 | } 226 | } 227 | 228 | draw_generic_menu(menuItems, selectionRef, caption, onConfirmation, NULL, NULL); 229 | } 230 | 231 | void draw_menu_from_struct_def(StringStandardOrToggleMenuDef defs[], int lineCount, int* selectionRef, std::string caption, bool(*onConfirmation)(MenuItem value)) 232 | { 233 | MenuItemVector menuItems; 234 | for (int i = 0; i < lineCount; i++) 235 | { 236 | if (defs[i].pState != NULL) 237 | { 238 | ToggleMenuItem item; 239 | item.caption = defs[i].text; 240 | item.toggleValue = defs[i].pState; 241 | item.currentMenuIndex = i; 242 | item.value = defs[i].value; 243 | if (defs[i].pUpdated != NULL) 244 | { 245 | item.toggleValueUpdated = defs[i].pUpdated; 246 | } 247 | menuItems.push_back(item); 248 | } 249 | else 250 | { 251 | MenuItem item; 252 | item.caption = defs[i].text; 253 | item.value = defs[i].value; 254 | item.currentMenuIndex = i; 255 | menuItems.push_back(item); 256 | } 257 | } 258 | 259 | draw_generic_menu(menuItems, selectionRef, caption, onConfirmation, NULL, NULL); 260 | } 261 | 262 | std::string show_keyboard(char* title_id, char* prepopulated_text) 263 | { 264 | DWORD time = GetTickCount() + 400; 265 | while (GetTickCount() < time) 266 | { 267 | make_periodic_feature_call(); 268 | WAIT(0); 269 | } 270 | 271 | GAMEPLAY::DISPLAY_ONSCREEN_KEYBOARD( 272 | true, 273 | const_cast(title_id == NULL ? "HUD_TITLE" : title_id), 274 | "", 275 | const_cast(prepopulated_text == NULL ? "" : prepopulated_text), 276 | "", "", "", 64); 277 | 278 | while (GAMEPLAY::UPDATE_ONSCREEN_KEYBOARD() == 0) 279 | { 280 | //update_status_text(); 281 | WAIT(0); 282 | } 283 | 284 | std::stringstream ss; 285 | if (!GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT()) 286 | { 287 | return std::string(""); 288 | } 289 | else 290 | { 291 | return std::string(GAMEPLAY::GET_ONSCREEN_KEYBOARD_RESULT()); 292 | } 293 | } 294 | 295 | 296 | template 297 | void MenuItem::onConfirm() 298 | { 299 | //set_status_text("Parent confirm"); 300 | if (onConfirmFunction != NULL) 301 | { 302 | onConfirmFunction(*this); 303 | } 304 | } 305 | 306 | template 307 | void ToggleMenuItem::onConfirm() 308 | { 309 | MenuItem::onConfirm(); 310 | 311 | if (toggleValue != NULL) 312 | { 313 | *toggleValue = !*toggleValue; 314 | if (toggleValueUpdated != NULL) 315 | { 316 | *toggleValueUpdated = true; 317 | } 318 | } 319 | } 320 | 321 | template 322 | int WantedSymbolItem::get_wanted_value() 323 | { 324 | return PLAYER::GET_PLAYER_WANTED_LEVEL(PLAYER::PLAYER_ID()); 325 | } 326 | 327 | template 328 | void WantedSymbolItem::handleLeftPress() 329 | { 330 | BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()); 331 | Player player = PLAYER::PLAYER_ID(); 332 | int currentLevel = PLAYER::GET_PLAYER_WANTED_LEVEL(player); 333 | if (bPlayerExists && currentLevel > 0) 334 | { 335 | PLAYER::SET_PLAYER_WANTED_LEVEL(player, --currentLevel, 0); 336 | PLAYER::SET_PLAYER_WANTED_LEVEL_NOW(player, 0); 337 | } 338 | 339 | if (currentLevel < 0) 340 | { 341 | set_status_text("~b~Cannot lower wanted level further."); 342 | } 343 | } 344 | 345 | template 346 | void WantedSymbolItem::handleRightPress() 347 | { 348 | turn_off_never_wanted(); 349 | BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()); 350 | Player player = PLAYER::PLAYER_ID(); 351 | int currentLevel = PLAYER::GET_PLAYER_WANTED_LEVEL(player); 352 | if (bPlayerExists && currentLevel < 5) 353 | { 354 | PLAYER::SET_PLAYER_WANTED_LEVEL(player, ++currentLevel, 0); 355 | PLAYER::SET_PLAYER_WANTED_LEVEL_NOW(player, 0); 356 | } 357 | 358 | if (currentLevel > 5) 359 | { 360 | set_status_text("~b~Cannot raise wanted level further."); 361 | } 362 | } -------------------------------------------------------------------------------- /LambdaMenu/noclip.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | 16 | #include "menu_functions.h" 17 | #include "noclip.h" 18 | #include "keyboard.h" 19 | #include "config_io.h" 20 | #include "script.h" 21 | #include "colors.h" 22 | 23 | bool exitFlag = false; 24 | 25 | char* noclip_ANIM_A = "amb@world_human_stand_impatient@male@no_sign@base"; 26 | char* noclip_ANIM_B = "base"; 27 | 28 | int travelSpeed = 2; 29 | 30 | bool in_noclip_mode = false; 31 | 32 | bool help_showing = true; 33 | 34 | Vector3 curLocation; 35 | Vector3 curRotation; 36 | float curHeading; 37 | 38 | //Converts Radians to Degrees 39 | float deg_to_rad(float degs) 40 | { 41 | return degs * 3.14159265358979323846 / 180; 42 | } 43 | 44 | std::string noclipStatusLines[15]; 45 | 46 | DWORD noclipStatusTextDrawTicksMax; 47 | bool noclipStatusTextGxtEntry; 48 | 49 | void exit_noclip_menu_if_showing() 50 | { 51 | exitFlag = true; 52 | } 53 | 54 | void process_noclip_menu() 55 | { 56 | exitFlag = false; 57 | 58 | const float lineWidth = 264.0; 59 | const int lineCount = 1; 60 | bool loadedAnims = false; 61 | 62 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 63 | bool inVehicle = PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0) ? true : false; 64 | 65 | if (!inVehicle) 66 | { 67 | STREAMING::REQUEST_ANIM_DICT(noclip_ANIM_A); 68 | while (!STREAMING::HAS_ANIM_DICT_LOADED(noclip_ANIM_A)) 69 | { 70 | WAIT(0); 71 | } 72 | loadedAnims = true; 73 | } 74 | 75 | curLocation = ENTITY::GET_ENTITY_COORDS(playerPed, 0); 76 | curRotation = ENTITY::GET_ENTITY_ROTATION(playerPed, 0); 77 | curHeading = ENTITY::GET_ENTITY_HEADING(playerPed); 78 | 79 | while (true && !exitFlag) 80 | { 81 | in_noclip_mode = true; 82 | 83 | if (help_showing) 84 | { 85 | std::string caption = "~p~LAMBDA ~s~MENU NOCLIP MODE"; 86 | draw_menu_header_line(caption, 264.0f, 35.0f, 0.0f, 1016.0f, 1026.0f, false); 87 | } 88 | 89 | make_periodic_feature_call(); 90 | 91 | 92 | if (ENTITY::IS_ENTITY_DEAD(playerPed)) 93 | { 94 | exitFlag = true; 95 | } 96 | else if (noclip_switch_pressed()) 97 | { 98 | menu_beep(); 99 | break; 100 | } 101 | 102 | noclip(inVehicle); 103 | 104 | WAIT(0); 105 | } 106 | 107 | if (!inVehicle) 108 | { 109 | AI::CLEAR_PED_TASKS_IMMEDIATELY(PLAYER::PLAYER_PED_ID()); 110 | AUDIO::SET_USER_RADIO_CONTROL_ENABLED(1); 111 | PLAYER::SET_PLAYER_INVINCIBLE(PLAYER::PLAYER_ID(), FALSE); 112 | } 113 | else 114 | { 115 | AUDIO::SET_USER_RADIO_CONTROL_ENABLED(1); 116 | PLAYER::SET_PLAYER_INVINCIBLE(PLAYER::PLAYER_ID(), FALSE); 117 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 118 | ENTITY::SET_ENTITY_INVINCIBLE(veh, FALSE); 119 | } 120 | 121 | exitFlag = false; 122 | in_noclip_mode = false; 123 | } 124 | 125 | void update_noclip_text() 126 | { 127 | if (help_showing) 128 | { 129 | if (GetTickCount() < noclipStatusTextDrawTicksMax) 130 | { 131 | int numLines = sizeof(noclipStatusLines) / sizeof(noclipStatusLines[0]); 132 | 133 | float textY = 0.053f; 134 | 135 | int numActualLines = 0; 136 | for (int i = 0; i < numLines; i++) 137 | { 138 | 139 | numActualLines++; 140 | 141 | UI::SET_TEXT_FONT(0); 142 | UI::SET_TEXT_SCALE(0.332, 0.332); 143 | if (i == 0 || i == 8 || i == 14) 144 | { 145 | UI::SET_TEXT_COLOUR(255, 180, 0, 255); 146 | } 147 | else 148 | { 149 | UI::SET_TEXT_COLOUR(255, 255, 255, 255); 150 | } 151 | UI::SET_TEXT_WRAP(0.0, 1.0); 152 | UI::SET_TEXT_EDGE(1, 0, 0, 0, 305); 153 | if (noclipStatusTextGxtEntry) 154 | { 155 | UI::_SET_TEXT_ENTRY((char *)noclipStatusLines[i].c_str()); 156 | } 157 | else 158 | { 159 | UI::_SET_TEXT_ENTRY("STRING"); 160 | UI::_ADD_TEXT_COMPONENT_STRING((char *)noclipStatusLines[i].c_str()); 161 | } 162 | UI::_DRAW_TEXT(0.802, textY); //increase to move right 163 | 164 | textY += 0.024f; //verticle spacing 165 | } 166 | 167 | int screen_w, screen_h; 168 | GRAPHICS::GET_SCREEN_RESOLUTION(&screen_w, &screen_h); 169 | float rectWidthScaled = 264 / (float)screen_w; 170 | float rectHeightScaled = (11 + (numActualLines * 9)) / (float)screen_h; 171 | float rectXScaled = 571.5 / (float)screen_h; //increase to move right 172 | float rectYScaled = 35 / (float)screen_h; 173 | 174 | int rect_col[4] = { 0, 0, 0, 50 }; 175 | 176 | // rect 177 | draw_rect(rectXScaled, rectYScaled, 178 | rectWidthScaled, rectHeightScaled, 179 | rect_col[0], rect_col[1], rect_col[2], rect_col[3]); 180 | } 181 | } 182 | } 183 | 184 | void create_noclip_help_text() 185 | { 186 | 187 | std::stringstream ss; 188 | 189 | std::string travelSpeedStr; 190 | switch (travelSpeed) 191 | { 192 | case 0: 193 | travelSpeedStr = "Very Slow"; 194 | break; 195 | case 1: 196 | travelSpeedStr = "Slow"; 197 | break; 198 | case 2: 199 | travelSpeedStr = "Medium"; 200 | break; 201 | case 3: 202 | travelSpeedStr = "Fast"; 203 | break; 204 | case 4: 205 | travelSpeedStr = "Very Fast"; 206 | break; 207 | case 5: 208 | travelSpeedStr = "Extremely Fast"; 209 | break; 210 | case 6: 211 | travelSpeedStr = "~r~Fast as fuck!"; 212 | break; 213 | } 214 | 215 | ss << "~w~Current Travel Speed: ~p~" << travelSpeedStr; 216 | 217 | int index = 0; 218 | noclipStatusLines[index++] = "~w~H ~HUD_COLOUR_BLACK~- ~w~Hide ~HUD_COLOUR_BLACK~/ ~w~Show NoClip Menu"; 219 | noclipStatusLines[index++] = " "; 220 | noclipStatusLines[index++] = "~w~Q ~HUD_COLOUR_BLACK~/ ~w~Z ~HUD_COLOUR_BLACK~- ~w~Move Up ~HUD_COLOUR_BLACK~/ ~w~Down"; 221 | noclipStatusLines[index++] = "~w~A ~HUD_COLOUR_BLACK~/ ~w~D ~HUD_COLOUR_BLACK~- ~w~Rotate Left ~HUD_COLOUR_BLACK~/ ~w~Right"; 222 | noclipStatusLines[index++] = "~w~W ~HUD_COLOUR_BLACK~/ ~w~S ~HUD_COLOUR_BLACK~- ~w~Move Forward ~HUD_COLOUR_BLACK~/ ~w~Back"; 223 | noclipStatusLines[index++] = "~w~Shift ~HUD_COLOUR_BLACK~- ~w~Toggle Move Speed"; 224 | noclipStatusLines[index++] = " "; 225 | noclipStatusLines[index++] = ss.str(); 226 | 227 | noclipStatusTextDrawTicksMax = GetTickCount() + 2500; 228 | noclipStatusTextGxtEntry = false; 229 | } 230 | 231 | void moveThroughDoor() 232 | { 233 | // common variables 234 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 235 | 236 | if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) 237 | { 238 | return; 239 | } 240 | 241 | curLocation = ENTITY::GET_ENTITY_COORDS(playerPed, 0); 242 | curHeading = ENTITY::GET_ENTITY_HEADING(playerPed); 243 | 244 | float forwardPush = 0.6; 245 | 246 | float xVect = forwardPush * sin(deg_to_rad(curHeading)) * -1.0f; 247 | float yVect = forwardPush * cos(deg_to_rad(curHeading)); 248 | 249 | ENTITY::SET_ENTITY_COORDS_NO_OFFSET(playerPed, curLocation.x + xVect, curLocation.y + yVect, curLocation.z, 1, 1, 1); 250 | } 251 | 252 | bool lshiftWasDown = false; 253 | 254 | void noclip(bool inVehicle) 255 | { 256 | // common variables 257 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 258 | BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(playerPed); 259 | 260 | float rotationSpeed = 2.5; 261 | float forwardPush; 262 | 263 | switch (travelSpeed) 264 | { 265 | case 0: 266 | forwardPush = 0.05f; // very slow 267 | break; 268 | case 1: 269 | forwardPush = 0.2f; // slow 270 | break; 271 | case 2: 272 | forwardPush = 0.8f; // medium 273 | break; 274 | case 3: 275 | forwardPush = 1.8f; // fast 276 | break; 277 | case 4: 278 | forwardPush = 3.6f; // very fast 279 | break; 280 | case 5: 281 | forwardPush = 5.4f; //extremely fast 282 | break; 283 | case 6: 284 | forwardPush = 10.0f; // fast as fuck 285 | break; 286 | case 7: 287 | forwardPush = 30.0f; 288 | break; 289 | } 290 | 291 | float xVect = forwardPush * sin(deg_to_rad(curHeading)) * -1.0f; 292 | float yVect = forwardPush * cos(deg_to_rad(curHeading)); 293 | 294 | KeyInputConfig* keyConfig = get_config()->get_key_config(); 295 | 296 | bool moveUpKey = get_key_pressed(keyConfig->key_noclip_up); 297 | bool moveDownKey = get_key_pressed(keyConfig->key_noclip_down); 298 | bool moveForwardKey = get_key_pressed(keyConfig->key_noclip_forward); 299 | bool moveBackKey = get_key_pressed(keyConfig->key_noclip_back); 300 | bool rotateLeftKey = get_key_pressed(keyConfig->key_noclip_rotate_left); 301 | bool rotateRightKey = get_key_pressed(keyConfig->key_noclip_rotate_right); 302 | 303 | //noclip controls vehicle if occupied 304 | Entity target = playerPed; 305 | if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) 306 | { 307 | target = PED::GET_VEHICLE_PED_IS_USING(playerPed); 308 | } 309 | 310 | ENTITY::SET_ENTITY_VELOCITY(playerPed, 0.0f, 0.0f, 0.0f); 311 | ENTITY::SET_ENTITY_ROTATION(playerPed, 0, 0, 0, 0, false); 312 | 313 | if (!inVehicle) 314 | { 315 | AI::TASK_PLAY_ANIM(PLAYER::PLAYER_PED_ID(), noclip_ANIM_A, noclip_ANIM_B, 8.0f, 0.0f, -1, 9, 0, 0, 0, 0); 316 | AUDIO::SET_USER_RADIO_CONTROL_ENABLED(0); 317 | PLAYER::SET_PLAYER_INVINCIBLE(PLAYER::PLAYER_ID(), TRUE); 318 | } 319 | 320 | else 321 | { 322 | AUDIO::SET_USER_RADIO_CONTROL_ENABLED(0); 323 | PLAYER::SET_PLAYER_INVINCIBLE(PLAYER::PLAYER_ID(), TRUE); 324 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 325 | ENTITY::SET_ENTITY_INVINCIBLE(veh, TRUE); 326 | } 327 | 328 | if (IsKeyJustUp(keyConfig->key_noclip_speed)) 329 | { 330 | travelSpeed++; 331 | if (travelSpeed > 6) 332 | { 333 | travelSpeed = 0; 334 | } 335 | } 336 | 337 | if (IsKeyJustUp(VK_KEY_H)) 338 | { 339 | help_showing = !help_showing; 340 | } 341 | 342 | create_noclip_help_text(); 343 | update_noclip_text(); 344 | 345 | if (moveUpKey) 346 | { 347 | curLocation.z += forwardPush / 2; 348 | } 349 | else if (moveDownKey) 350 | { 351 | curLocation.z -= forwardPush / 2; 352 | } 353 | 354 | if (moveForwardKey) 355 | { 356 | curLocation.x += xVect; 357 | curLocation.y += yVect; 358 | } 359 | else if (moveBackKey) 360 | { 361 | curLocation.x -= xVect; 362 | curLocation.y -= yVect; 363 | } 364 | 365 | if (rotateLeftKey) 366 | { 367 | curHeading += rotationSpeed; 368 | } 369 | else if (rotateRightKey) 370 | { 371 | curHeading -= rotationSpeed; 372 | } 373 | 374 | ENTITY::SET_ENTITY_COORDS_NO_OFFSET(target, curLocation.x, curLocation.y, curLocation.z, 1, 1, 1); 375 | ENTITY::SET_ENTITY_HEADING(target, curHeading - rotationSpeed); 376 | } 377 | 378 | bool is_in_noclip_mode() 379 | { 380 | return in_noclip_mode; 381 | } 382 | -------------------------------------------------------------------------------- /LambdaMenu/LambdaMenu.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Development 10 | x64 11 | 12 | 13 | EnhancedReborn_DB 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Sync 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | Designer 73 | 74 | 75 | 76 | 77 | 78 | 79 | {8D82F34A-1D64-465B-84B1-37F89AD3D20B} 80 | Win32Proj 81 | MultiFiveMenu 82 | LambdaMenu 83 | 10.0 84 | 85 | 86 | 87 | DynamicLibrary 88 | true 89 | v143 90 | MultiByte 91 | 92 | 93 | DynamicLibrary 94 | false 95 | v143 96 | true 97 | NotSet 98 | 99 | 100 | DynamicLibrary 101 | false 102 | v143 103 | true 104 | MultiByte 105 | 106 | 107 | DynamicLibrary 108 | false 109 | v143 110 | true 111 | MultiByte 112 | 113 | 114 | 115 | x64 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | true 134 | .asi 135 | bin\$(Configuration)\ 136 | tmp\$(Configuration)\ 137 | 138 | 139 | false 140 | .asi 141 | bin\$(Configuration)\ 142 | tmp\$(Configuration)\ 143 | $(LibraryPath) 144 | C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include;$(IncludePath) 145 | 146 | 147 | false 148 | .asi 149 | bin\$(Configuration)\ 150 | tmp\$(Configuration)\ 151 | $(LibraryPath) 152 | C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include;$(IncludePath) 153 | 154 | 155 | false 156 | .asi 157 | bin\$(Configuration)\ 158 | tmp\$(Configuration)\ 159 | $(LibraryPath) 160 | C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include;$(IncludePath) 161 | 162 | 163 | 164 | 165 | 166 | Level3 167 | Disabled 168 | WIN32;_WINDOWS;_USRDLL;NativeTrainer_EXPORTS;DEVELOPMENT;%(PreprocessorDefinitions) 169 | MultiThreadedDebug 170 | false 171 | $(SolutionDir)\Vendor\msgpack-c\include;$(SolutionDir)\Client\Include 172 | stdcpplatest 173 | 174 | 175 | Windows 176 | true 177 | lib\ScriptHookV.lib %(AdditionalOptions) 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | Level3 187 | 188 | 189 | MaxSpeed 190 | true 191 | true 192 | WIN32;NDEBUG;_WINDOWS;_USRDLL;NativeTrainer_EXPORTS;%(PreprocessorDefinitions) 193 | MultiThreaded 194 | Fast 195 | Sync 196 | stdcpp17 197 | $(SolutionDir)\Vendor\msgpack-c\include;$(SolutionDir)\Client\Include 198 | 199 | 200 | Windows 201 | false 202 | true 203 | true 204 | lib\ScriptHookV.lib;msxml6.lib;%(AdditionalDependencies) 205 | 206 | 207 | 208 | 209 | Level3 210 | 211 | 212 | MaxSpeed 213 | true 214 | true 215 | WIN32;NDEBUG;_WINDOWS;_USRDLL;NativeTrainer_EXPORTS;ER_DB;%(PreprocessorDefinitions) 216 | MultiThreaded 217 | Fast 218 | Sync 219 | $(SolutionDir)\Client\Include 220 | stdcpplatest 221 | 222 | 223 | Windows 224 | false 225 | true 226 | true 227 | lib\ScriptHookV.lib;msxml6.lib;%(AdditionalDependencies) 228 | 229 | 230 | 231 | 232 | Level3 233 | 234 | 235 | MaxSpeed 236 | true 237 | true 238 | WIN32;NDEBUG;_WINDOWS;_USRDLL;NativeTrainer_EXPORTS;DEVELOPMENT;%(PreprocessorDefinitions) 239 | MultiThreaded 240 | Fast 241 | Sync 242 | $(SolutionDir)\Client\Include 243 | stdcpplatest 244 | 245 | 246 | Windows 247 | false 248 | true 249 | true 250 | lib\ScriptHookV.lib;msxml6.lib;%(AdditionalDependencies) 251 | 252 | 253 | 254 | 255 | 256 | 257 | -------------------------------------------------------------------------------- /Client/Include/nativeCaller.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "main.h" 10 | 11 | template 12 | static inline void nativePush(T val) 13 | { 14 | UINT64 val64 = 0; 15 | if (sizeof(T) > sizeof(UINT64)) 16 | { 17 | throw "error, value size > 64 bit"; 18 | } 19 | *reinterpret_cast(&val64) = val; // &val + sizeof(dw) - sizeof(val) 20 | nativePush64(val64); 21 | } 22 | 23 | template 24 | static inline R invoke(UINT64 hash) 25 | { 26 | nativeInit(hash); 27 | return *reinterpret_cast(nativeCall()); 28 | } 29 | 30 | template 31 | static inline R invoke(UINT64 hash, T1 P1) 32 | { 33 | nativeInit(hash); 34 | 35 | nativePush(P1); 36 | 37 | return *reinterpret_cast(nativeCall()); 38 | } 39 | 40 | template 41 | static inline R invoke(UINT64 hash, T1 P1, T2 P2) 42 | { 43 | nativeInit(hash); 44 | 45 | nativePush(P1); 46 | nativePush(P2); 47 | 48 | return *reinterpret_cast(nativeCall()); 49 | } 50 | 51 | template 52 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3) 53 | { 54 | nativeInit(hash); 55 | 56 | nativePush(P1); 57 | nativePush(P2); 58 | nativePush(P3); 59 | 60 | return *reinterpret_cast(nativeCall()); 61 | } 62 | 63 | template 64 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4) 65 | { 66 | nativeInit(hash); 67 | 68 | nativePush(P1); 69 | nativePush(P2); 70 | nativePush(P3); 71 | nativePush(P4); 72 | 73 | return *reinterpret_cast(nativeCall()); 74 | } 75 | 76 | template 77 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5) 78 | { 79 | nativeInit(hash); 80 | 81 | nativePush(P1); 82 | nativePush(P2); 83 | nativePush(P3); 84 | nativePush(P4); 85 | nativePush(P5); 86 | 87 | return *reinterpret_cast(nativeCall()); 88 | } 89 | 90 | template 91 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6) 92 | { 93 | nativeInit(hash); 94 | 95 | nativePush(P1); 96 | nativePush(P2); 97 | nativePush(P3); 98 | nativePush(P4); 99 | nativePush(P5); 100 | nativePush(P6); 101 | 102 | return *reinterpret_cast(nativeCall()); 103 | } 104 | 105 | template 106 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7) 107 | { 108 | nativeInit(hash); 109 | 110 | nativePush(P1); 111 | nativePush(P2); 112 | nativePush(P3); 113 | nativePush(P4); 114 | nativePush(P5); 115 | nativePush(P6); 116 | nativePush(P7); 117 | 118 | return *reinterpret_cast(nativeCall()); 119 | } 120 | 121 | template 122 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8) 123 | { 124 | nativeInit(hash); 125 | 126 | nativePush(P1); 127 | nativePush(P2); 128 | nativePush(P3); 129 | nativePush(P4); 130 | nativePush(P5); 131 | nativePush(P6); 132 | nativePush(P7); 133 | nativePush(P8); 134 | 135 | return *reinterpret_cast(nativeCall()); 136 | } 137 | 138 | template 139 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9) 140 | { 141 | nativeInit(hash); 142 | 143 | nativePush(P1); 144 | nativePush(P2); 145 | nativePush(P3); 146 | nativePush(P4); 147 | nativePush(P5); 148 | nativePush(P6); 149 | nativePush(P7); 150 | nativePush(P8); 151 | nativePush(P9); 152 | 153 | return *reinterpret_cast(nativeCall()); 154 | } 155 | 156 | template 157 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10) 158 | { 159 | nativeInit(hash); 160 | 161 | nativePush(P1); 162 | nativePush(P2); 163 | nativePush(P3); 164 | nativePush(P4); 165 | nativePush(P5); 166 | nativePush(P6); 167 | nativePush(P7); 168 | nativePush(P8); 169 | nativePush(P9); 170 | nativePush(P10); 171 | 172 | return *reinterpret_cast(nativeCall()); 173 | } 174 | 175 | template 176 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11) 177 | { 178 | nativeInit(hash); 179 | 180 | nativePush(P1); 181 | nativePush(P2); 182 | nativePush(P3); 183 | nativePush(P4); 184 | nativePush(P5); 185 | nativePush(P6); 186 | nativePush(P7); 187 | nativePush(P8); 188 | nativePush(P9); 189 | nativePush(P10); 190 | nativePush(P11); 191 | 192 | return *reinterpret_cast(nativeCall()); 193 | } 194 | 195 | template 196 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12) 197 | { 198 | nativeInit(hash); 199 | 200 | nativePush(P1); 201 | nativePush(P2); 202 | nativePush(P3); 203 | nativePush(P4); 204 | nativePush(P5); 205 | nativePush(P6); 206 | nativePush(P7); 207 | nativePush(P8); 208 | nativePush(P9); 209 | nativePush(P10); 210 | nativePush(P11); 211 | nativePush(P12); 212 | 213 | return *reinterpret_cast(nativeCall()); 214 | } 215 | 216 | template 217 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13) 218 | { 219 | nativeInit(hash); 220 | 221 | nativePush(P1); 222 | nativePush(P2); 223 | nativePush(P3); 224 | nativePush(P4); 225 | nativePush(P5); 226 | nativePush(P6); 227 | nativePush(P7); 228 | nativePush(P8); 229 | nativePush(P9); 230 | nativePush(P10); 231 | nativePush(P11); 232 | nativePush(P12); 233 | nativePush(P13); 234 | 235 | return *reinterpret_cast(nativeCall()); 236 | } 237 | 238 | template 239 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14) 240 | { 241 | nativeInit(hash); 242 | 243 | nativePush(P1); 244 | nativePush(P2); 245 | nativePush(P3); 246 | nativePush(P4); 247 | nativePush(P5); 248 | nativePush(P6); 249 | nativePush(P7); 250 | nativePush(P8); 251 | nativePush(P9); 252 | nativePush(P10); 253 | nativePush(P11); 254 | nativePush(P12); 255 | nativePush(P13); 256 | nativePush(P14); 257 | 258 | return *reinterpret_cast(nativeCall()); 259 | } 260 | 261 | template 262 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15) 263 | { 264 | nativeInit(hash); 265 | 266 | nativePush(P1); 267 | nativePush(P2); 268 | nativePush(P3); 269 | nativePush(P4); 270 | nativePush(P5); 271 | nativePush(P6); 272 | nativePush(P7); 273 | nativePush(P8); 274 | nativePush(P9); 275 | nativePush(P10); 276 | nativePush(P11); 277 | nativePush(P12); 278 | nativePush(P13); 279 | nativePush(P14); 280 | nativePush(P15); 281 | 282 | return *reinterpret_cast(nativeCall()); 283 | } 284 | 285 | template 286 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16) 287 | { 288 | nativeInit(hash); 289 | 290 | nativePush(P1); 291 | nativePush(P2); 292 | nativePush(P3); 293 | nativePush(P4); 294 | nativePush(P5); 295 | nativePush(P6); 296 | nativePush(P7); 297 | nativePush(P8); 298 | nativePush(P9); 299 | nativePush(P10); 300 | nativePush(P11); 301 | nativePush(P12); 302 | nativePush(P13); 303 | nativePush(P14); 304 | nativePush(P15); 305 | nativePush(P16); 306 | 307 | return *reinterpret_cast(nativeCall()); 308 | } 309 | 310 | template 311 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17) 312 | { 313 | nativeInit(hash); 314 | 315 | nativePush(P1); 316 | nativePush(P2); 317 | nativePush(P3); 318 | nativePush(P4); 319 | nativePush(P5); 320 | nativePush(P6); 321 | nativePush(P7); 322 | nativePush(P8); 323 | nativePush(P9); 324 | nativePush(P10); 325 | nativePush(P11); 326 | nativePush(P12); 327 | nativePush(P13); 328 | nativePush(P14); 329 | nativePush(P15); 330 | nativePush(P16); 331 | nativePush(P17); 332 | 333 | return *reinterpret_cast(nativeCall()); 334 | } 335 | 336 | template 337 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18) 338 | { 339 | nativeInit(hash); 340 | 341 | nativePush(P1); 342 | nativePush(P2); 343 | nativePush(P3); 344 | nativePush(P4); 345 | nativePush(P5); 346 | nativePush(P6); 347 | nativePush(P7); 348 | nativePush(P8); 349 | nativePush(P9); 350 | nativePush(P10); 351 | nativePush(P11); 352 | nativePush(P12); 353 | nativePush(P13); 354 | nativePush(P14); 355 | nativePush(P15); 356 | nativePush(P16); 357 | nativePush(P17); 358 | nativePush(P18); 359 | 360 | return *reinterpret_cast(nativeCall()); 361 | } 362 | 363 | template 364 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19) 365 | { 366 | nativeInit(hash); 367 | 368 | nativePush(P1); 369 | nativePush(P2); 370 | nativePush(P3); 371 | nativePush(P4); 372 | nativePush(P5); 373 | nativePush(P6); 374 | nativePush(P7); 375 | nativePush(P8); 376 | nativePush(P9); 377 | nativePush(P10); 378 | nativePush(P11); 379 | nativePush(P12); 380 | nativePush(P13); 381 | nativePush(P14); 382 | nativePush(P15); 383 | nativePush(P16); 384 | nativePush(P17); 385 | nativePush(P18); 386 | nativePush(P19); 387 | 388 | return *reinterpret_cast(nativeCall()); 389 | } 390 | 391 | template 392 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20) 393 | { 394 | nativeInit(hash); 395 | 396 | nativePush(P1); 397 | nativePush(P2); 398 | nativePush(P3); 399 | nativePush(P4); 400 | nativePush(P5); 401 | nativePush(P6); 402 | nativePush(P7); 403 | nativePush(P8); 404 | nativePush(P9); 405 | nativePush(P10); 406 | nativePush(P11); 407 | nativePush(P12); 408 | nativePush(P13); 409 | nativePush(P14); 410 | nativePush(P15); 411 | nativePush(P16); 412 | nativePush(P17); 413 | nativePush(P18); 414 | nativePush(P19); 415 | nativePush(P20); 416 | 417 | return *reinterpret_cast(nativeCall()); 418 | } 419 | 420 | template 421 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21) 422 | { 423 | nativeInit(hash); 424 | 425 | nativePush(P1); 426 | nativePush(P2); 427 | nativePush(P3); 428 | nativePush(P4); 429 | nativePush(P5); 430 | nativePush(P6); 431 | nativePush(P7); 432 | nativePush(P8); 433 | nativePush(P9); 434 | nativePush(P10); 435 | nativePush(P11); 436 | nativePush(P12); 437 | nativePush(P13); 438 | nativePush(P14); 439 | nativePush(P15); 440 | nativePush(P16); 441 | nativePush(P17); 442 | nativePush(P18); 443 | nativePush(P19); 444 | nativePush(P20); 445 | nativePush(P21); 446 | 447 | return *reinterpret_cast(nativeCall()); 448 | } 449 | 450 | template 451 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21, T22 P22) 452 | { 453 | nativeInit(hash); 454 | 455 | nativePush(P1); 456 | nativePush(P2); 457 | nativePush(P3); 458 | nativePush(P4); 459 | nativePush(P5); 460 | nativePush(P6); 461 | nativePush(P7); 462 | nativePush(P8); 463 | nativePush(P9); 464 | nativePush(P10); 465 | nativePush(P11); 466 | nativePush(P12); 467 | nativePush(P13); 468 | nativePush(P14); 469 | nativePush(P15); 470 | nativePush(P16); 471 | nativePush(P17); 472 | nativePush(P18); 473 | nativePush(P19); 474 | nativePush(P20); 475 | nativePush(P21); 476 | nativePush(P22); 477 | 478 | return *reinterpret_cast(nativeCall()); 479 | } 480 | 481 | template 482 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21, T22 P22, T23 P23) 483 | { 484 | nativeInit(hash); 485 | 486 | nativePush(P1); 487 | nativePush(P2); 488 | nativePush(P3); 489 | nativePush(P4); 490 | nativePush(P5); 491 | nativePush(P6); 492 | nativePush(P7); 493 | nativePush(P8); 494 | nativePush(P9); 495 | nativePush(P10); 496 | nativePush(P11); 497 | nativePush(P12); 498 | nativePush(P13); 499 | nativePush(P14); 500 | nativePush(P15); 501 | nativePush(P16); 502 | nativePush(P17); 503 | nativePush(P18); 504 | nativePush(P19); 505 | nativePush(P20); 506 | nativePush(P21); 507 | nativePush(P22); 508 | nativePush(P23); 509 | 510 | return *reinterpret_cast(nativeCall()); 511 | } 512 | 513 | template 514 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21, T22 P22, T23 P23, T24 P24) 515 | { 516 | nativeInit(hash); 517 | 518 | nativePush(P1); 519 | nativePush(P2); 520 | nativePush(P3); 521 | nativePush(P4); 522 | nativePush(P5); 523 | nativePush(P6); 524 | nativePush(P7); 525 | nativePush(P8); 526 | nativePush(P9); 527 | nativePush(P10); 528 | nativePush(P11); 529 | nativePush(P12); 530 | nativePush(P13); 531 | nativePush(P14); 532 | nativePush(P15); 533 | nativePush(P16); 534 | nativePush(P17); 535 | nativePush(P18); 536 | nativePush(P19); 537 | nativePush(P20); 538 | nativePush(P21); 539 | nativePush(P22); 540 | nativePush(P23); 541 | nativePush(P24); 542 | 543 | return *reinterpret_cast(nativeCall()); 544 | } 545 | 546 | template 547 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21, T22 P22, T23 P23, T24 P24, T25 P25) 548 | { 549 | nativeInit(hash); 550 | 551 | nativePush(P1); 552 | nativePush(P2); 553 | nativePush(P3); 554 | nativePush(P4); 555 | nativePush(P5); 556 | nativePush(P6); 557 | nativePush(P7); 558 | nativePush(P8); 559 | nativePush(P9); 560 | nativePush(P10); 561 | nativePush(P11); 562 | nativePush(P12); 563 | nativePush(P13); 564 | nativePush(P14); 565 | nativePush(P15); 566 | nativePush(P16); 567 | nativePush(P17); 568 | nativePush(P18); 569 | nativePush(P19); 570 | nativePush(P20); 571 | nativePush(P21); 572 | nativePush(P22); 573 | nativePush(P23); 574 | nativePush(P24); 575 | nativePush(P25); 576 | 577 | return *reinterpret_cast(nativeCall()); 578 | } -------------------------------------------------------------------------------- /LambdaMenu/inc/nativeCaller.h: -------------------------------------------------------------------------------- 1 | /* 2 | THIS FILE IS A PART OF GTA V SCRIPT HOOK SDK 3 | http://dev-c.com 4 | (C) Alexander Blade 2015 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "main.h" 10 | 11 | template 12 | static inline void nativePush(T val) 13 | { 14 | UINT64 val64 = 0; 15 | if (sizeof(T) > sizeof(UINT64)) 16 | { 17 | throw "error, value size > 64 bit"; 18 | } 19 | *reinterpret_cast(&val64) = val; // &val + sizeof(dw) - sizeof(val) 20 | nativePush64(val64); 21 | } 22 | 23 | template 24 | static inline R invoke(UINT64 hash) 25 | { 26 | nativeInit(hash); 27 | return *reinterpret_cast(nativeCall()); 28 | } 29 | 30 | template 31 | static inline R invoke(UINT64 hash, T1 P1) 32 | { 33 | nativeInit(hash); 34 | 35 | nativePush(P1); 36 | 37 | return *reinterpret_cast(nativeCall()); 38 | } 39 | 40 | template 41 | static inline R invoke(UINT64 hash, T1 P1, T2 P2) 42 | { 43 | nativeInit(hash); 44 | 45 | nativePush(P1); 46 | nativePush(P2); 47 | 48 | return *reinterpret_cast(nativeCall()); 49 | } 50 | 51 | template 52 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3) 53 | { 54 | nativeInit(hash); 55 | 56 | nativePush(P1); 57 | nativePush(P2); 58 | nativePush(P3); 59 | 60 | return *reinterpret_cast(nativeCall()); 61 | } 62 | 63 | template 64 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4) 65 | { 66 | nativeInit(hash); 67 | 68 | nativePush(P1); 69 | nativePush(P2); 70 | nativePush(P3); 71 | nativePush(P4); 72 | 73 | return *reinterpret_cast(nativeCall()); 74 | } 75 | 76 | template 77 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5) 78 | { 79 | nativeInit(hash); 80 | 81 | nativePush(P1); 82 | nativePush(P2); 83 | nativePush(P3); 84 | nativePush(P4); 85 | nativePush(P5); 86 | 87 | return *reinterpret_cast(nativeCall()); 88 | } 89 | 90 | template 91 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6) 92 | { 93 | nativeInit(hash); 94 | 95 | nativePush(P1); 96 | nativePush(P2); 97 | nativePush(P3); 98 | nativePush(P4); 99 | nativePush(P5); 100 | nativePush(P6); 101 | 102 | return *reinterpret_cast(nativeCall()); 103 | } 104 | 105 | template 106 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7) 107 | { 108 | nativeInit(hash); 109 | 110 | nativePush(P1); 111 | nativePush(P2); 112 | nativePush(P3); 113 | nativePush(P4); 114 | nativePush(P5); 115 | nativePush(P6); 116 | nativePush(P7); 117 | 118 | return *reinterpret_cast(nativeCall()); 119 | } 120 | 121 | template 122 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8) 123 | { 124 | nativeInit(hash); 125 | 126 | nativePush(P1); 127 | nativePush(P2); 128 | nativePush(P3); 129 | nativePush(P4); 130 | nativePush(P5); 131 | nativePush(P6); 132 | nativePush(P7); 133 | nativePush(P8); 134 | 135 | return *reinterpret_cast(nativeCall()); 136 | } 137 | 138 | template 139 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9) 140 | { 141 | nativeInit(hash); 142 | 143 | nativePush(P1); 144 | nativePush(P2); 145 | nativePush(P3); 146 | nativePush(P4); 147 | nativePush(P5); 148 | nativePush(P6); 149 | nativePush(P7); 150 | nativePush(P8); 151 | nativePush(P9); 152 | 153 | return *reinterpret_cast(nativeCall()); 154 | } 155 | 156 | template 157 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10) 158 | { 159 | nativeInit(hash); 160 | 161 | nativePush(P1); 162 | nativePush(P2); 163 | nativePush(P3); 164 | nativePush(P4); 165 | nativePush(P5); 166 | nativePush(P6); 167 | nativePush(P7); 168 | nativePush(P8); 169 | nativePush(P9); 170 | nativePush(P10); 171 | 172 | return *reinterpret_cast(nativeCall()); 173 | } 174 | 175 | template 176 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11) 177 | { 178 | nativeInit(hash); 179 | 180 | nativePush(P1); 181 | nativePush(P2); 182 | nativePush(P3); 183 | nativePush(P4); 184 | nativePush(P5); 185 | nativePush(P6); 186 | nativePush(P7); 187 | nativePush(P8); 188 | nativePush(P9); 189 | nativePush(P10); 190 | nativePush(P11); 191 | 192 | return *reinterpret_cast(nativeCall()); 193 | } 194 | 195 | template 196 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12) 197 | { 198 | nativeInit(hash); 199 | 200 | nativePush(P1); 201 | nativePush(P2); 202 | nativePush(P3); 203 | nativePush(P4); 204 | nativePush(P5); 205 | nativePush(P6); 206 | nativePush(P7); 207 | nativePush(P8); 208 | nativePush(P9); 209 | nativePush(P10); 210 | nativePush(P11); 211 | nativePush(P12); 212 | 213 | return *reinterpret_cast(nativeCall()); 214 | } 215 | 216 | template 217 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13) 218 | { 219 | nativeInit(hash); 220 | 221 | nativePush(P1); 222 | nativePush(P2); 223 | nativePush(P3); 224 | nativePush(P4); 225 | nativePush(P5); 226 | nativePush(P6); 227 | nativePush(P7); 228 | nativePush(P8); 229 | nativePush(P9); 230 | nativePush(P10); 231 | nativePush(P11); 232 | nativePush(P12); 233 | nativePush(P13); 234 | 235 | return *reinterpret_cast(nativeCall()); 236 | } 237 | 238 | template 239 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14) 240 | { 241 | nativeInit(hash); 242 | 243 | nativePush(P1); 244 | nativePush(P2); 245 | nativePush(P3); 246 | nativePush(P4); 247 | nativePush(P5); 248 | nativePush(P6); 249 | nativePush(P7); 250 | nativePush(P8); 251 | nativePush(P9); 252 | nativePush(P10); 253 | nativePush(P11); 254 | nativePush(P12); 255 | nativePush(P13); 256 | nativePush(P14); 257 | 258 | return *reinterpret_cast(nativeCall()); 259 | } 260 | 261 | template 262 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15) 263 | { 264 | nativeInit(hash); 265 | 266 | nativePush(P1); 267 | nativePush(P2); 268 | nativePush(P3); 269 | nativePush(P4); 270 | nativePush(P5); 271 | nativePush(P6); 272 | nativePush(P7); 273 | nativePush(P8); 274 | nativePush(P9); 275 | nativePush(P10); 276 | nativePush(P11); 277 | nativePush(P12); 278 | nativePush(P13); 279 | nativePush(P14); 280 | nativePush(P15); 281 | 282 | return *reinterpret_cast(nativeCall()); 283 | } 284 | 285 | template 286 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16) 287 | { 288 | nativeInit(hash); 289 | 290 | nativePush(P1); 291 | nativePush(P2); 292 | nativePush(P3); 293 | nativePush(P4); 294 | nativePush(P5); 295 | nativePush(P6); 296 | nativePush(P7); 297 | nativePush(P8); 298 | nativePush(P9); 299 | nativePush(P10); 300 | nativePush(P11); 301 | nativePush(P12); 302 | nativePush(P13); 303 | nativePush(P14); 304 | nativePush(P15); 305 | nativePush(P16); 306 | 307 | return *reinterpret_cast(nativeCall()); 308 | } 309 | 310 | template 311 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17) 312 | { 313 | nativeInit(hash); 314 | 315 | nativePush(P1); 316 | nativePush(P2); 317 | nativePush(P3); 318 | nativePush(P4); 319 | nativePush(P5); 320 | nativePush(P6); 321 | nativePush(P7); 322 | nativePush(P8); 323 | nativePush(P9); 324 | nativePush(P10); 325 | nativePush(P11); 326 | nativePush(P12); 327 | nativePush(P13); 328 | nativePush(P14); 329 | nativePush(P15); 330 | nativePush(P16); 331 | nativePush(P17); 332 | 333 | return *reinterpret_cast(nativeCall()); 334 | } 335 | 336 | template 337 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18) 338 | { 339 | nativeInit(hash); 340 | 341 | nativePush(P1); 342 | nativePush(P2); 343 | nativePush(P3); 344 | nativePush(P4); 345 | nativePush(P5); 346 | nativePush(P6); 347 | nativePush(P7); 348 | nativePush(P8); 349 | nativePush(P9); 350 | nativePush(P10); 351 | nativePush(P11); 352 | nativePush(P12); 353 | nativePush(P13); 354 | nativePush(P14); 355 | nativePush(P15); 356 | nativePush(P16); 357 | nativePush(P17); 358 | nativePush(P18); 359 | 360 | return *reinterpret_cast(nativeCall()); 361 | } 362 | 363 | template 364 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19) 365 | { 366 | nativeInit(hash); 367 | 368 | nativePush(P1); 369 | nativePush(P2); 370 | nativePush(P3); 371 | nativePush(P4); 372 | nativePush(P5); 373 | nativePush(P6); 374 | nativePush(P7); 375 | nativePush(P8); 376 | nativePush(P9); 377 | nativePush(P10); 378 | nativePush(P11); 379 | nativePush(P12); 380 | nativePush(P13); 381 | nativePush(P14); 382 | nativePush(P15); 383 | nativePush(P16); 384 | nativePush(P17); 385 | nativePush(P18); 386 | nativePush(P19); 387 | 388 | return *reinterpret_cast(nativeCall()); 389 | } 390 | 391 | template 392 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20) 393 | { 394 | nativeInit(hash); 395 | 396 | nativePush(P1); 397 | nativePush(P2); 398 | nativePush(P3); 399 | nativePush(P4); 400 | nativePush(P5); 401 | nativePush(P6); 402 | nativePush(P7); 403 | nativePush(P8); 404 | nativePush(P9); 405 | nativePush(P10); 406 | nativePush(P11); 407 | nativePush(P12); 408 | nativePush(P13); 409 | nativePush(P14); 410 | nativePush(P15); 411 | nativePush(P16); 412 | nativePush(P17); 413 | nativePush(P18); 414 | nativePush(P19); 415 | nativePush(P20); 416 | 417 | return *reinterpret_cast(nativeCall()); 418 | } 419 | 420 | template 421 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21) 422 | { 423 | nativeInit(hash); 424 | 425 | nativePush(P1); 426 | nativePush(P2); 427 | nativePush(P3); 428 | nativePush(P4); 429 | nativePush(P5); 430 | nativePush(P6); 431 | nativePush(P7); 432 | nativePush(P8); 433 | nativePush(P9); 434 | nativePush(P10); 435 | nativePush(P11); 436 | nativePush(P12); 437 | nativePush(P13); 438 | nativePush(P14); 439 | nativePush(P15); 440 | nativePush(P16); 441 | nativePush(P17); 442 | nativePush(P18); 443 | nativePush(P19); 444 | nativePush(P20); 445 | nativePush(P21); 446 | 447 | return *reinterpret_cast(nativeCall()); 448 | } 449 | 450 | template 451 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21, T22 P22) 452 | { 453 | nativeInit(hash); 454 | 455 | nativePush(P1); 456 | nativePush(P2); 457 | nativePush(P3); 458 | nativePush(P4); 459 | nativePush(P5); 460 | nativePush(P6); 461 | nativePush(P7); 462 | nativePush(P8); 463 | nativePush(P9); 464 | nativePush(P10); 465 | nativePush(P11); 466 | nativePush(P12); 467 | nativePush(P13); 468 | nativePush(P14); 469 | nativePush(P15); 470 | nativePush(P16); 471 | nativePush(P17); 472 | nativePush(P18); 473 | nativePush(P19); 474 | nativePush(P20); 475 | nativePush(P21); 476 | nativePush(P22); 477 | 478 | return *reinterpret_cast(nativeCall()); 479 | } 480 | 481 | template 482 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21, T22 P22, T23 P23) 483 | { 484 | nativeInit(hash); 485 | 486 | nativePush(P1); 487 | nativePush(P2); 488 | nativePush(P3); 489 | nativePush(P4); 490 | nativePush(P5); 491 | nativePush(P6); 492 | nativePush(P7); 493 | nativePush(P8); 494 | nativePush(P9); 495 | nativePush(P10); 496 | nativePush(P11); 497 | nativePush(P12); 498 | nativePush(P13); 499 | nativePush(P14); 500 | nativePush(P15); 501 | nativePush(P16); 502 | nativePush(P17); 503 | nativePush(P18); 504 | nativePush(P19); 505 | nativePush(P20); 506 | nativePush(P21); 507 | nativePush(P22); 508 | nativePush(P23); 509 | 510 | return *reinterpret_cast(nativeCall()); 511 | } 512 | 513 | template 514 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21, T22 P22, T23 P23, T24 P24) 515 | { 516 | nativeInit(hash); 517 | 518 | nativePush(P1); 519 | nativePush(P2); 520 | nativePush(P3); 521 | nativePush(P4); 522 | nativePush(P5); 523 | nativePush(P6); 524 | nativePush(P7); 525 | nativePush(P8); 526 | nativePush(P9); 527 | nativePush(P10); 528 | nativePush(P11); 529 | nativePush(P12); 530 | nativePush(P13); 531 | nativePush(P14); 532 | nativePush(P15); 533 | nativePush(P16); 534 | nativePush(P17); 535 | nativePush(P18); 536 | nativePush(P19); 537 | nativePush(P20); 538 | nativePush(P21); 539 | nativePush(P22); 540 | nativePush(P23); 541 | nativePush(P24); 542 | 543 | return *reinterpret_cast(nativeCall()); 544 | } 545 | 546 | template 547 | static inline R invoke(UINT64 hash, T1 P1, T2 P2, T3 P3, T4 P4, T5 P5, T6 P6, T7 P7, T8 P8, T9 P9, T10 P10, T11 P11, T12 P12, T13 P13, T14 P14, T15 P15, T16 P16, T17 P17, T18 P18, T19 P19, T20 P20, T21 P21, T22 P22, T23 P23, T24 P24, T25 P25) 548 | { 549 | nativeInit(hash); 550 | 551 | nativePush(P1); 552 | nativePush(P2); 553 | nativePush(P3); 554 | nativePush(P4); 555 | nativePush(P5); 556 | nativePush(P6); 557 | nativePush(P7); 558 | nativePush(P8); 559 | nativePush(P9); 560 | nativePush(P10); 561 | nativePush(P11); 562 | nativePush(P12); 563 | nativePush(P13); 564 | nativePush(P14); 565 | nativePush(P15); 566 | nativePush(P16); 567 | nativePush(P17); 568 | nativePush(P18); 569 | nativePush(P19); 570 | nativePush(P20); 571 | nativePush(P21); 572 | nativePush(P22); 573 | nativePush(P23); 574 | nativePush(P24); 575 | nativePush(P25); 576 | 577 | return *reinterpret_cast(nativeCall()); 578 | } -------------------------------------------------------------------------------- /LambdaMenu/teleportation.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include "teleportation.h" 16 | #include "menu_functions.h" 17 | #include "debuglog.h" 18 | 19 | struct tele_location { 20 | std::string text; 21 | float x; 22 | float y; 23 | float z; 24 | std::vector scenery_required; 25 | std::vector scenery_toremove; 26 | bool isLoaded; 27 | }; 28 | 29 | int mainMenuIndex = 0; 30 | 31 | int lastChosenCategory = -1; 32 | 33 | int lastMenuChoiceInCategories[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; 34 | 35 | std::vector LOCATIONS_SAFE = { 36 | { "Michael's Safehouse", -827.138f, 176.368f, 70.4999f }, 37 | { "Franklin's Safehouse", -18.0355f, -1456.94f, 30.4548f }, 38 | { "Franklin's Safehouse 2", 10.8766f, 545.654f, 175.419f }, 39 | { "Trevor's Safehouse", 1982.13f, 3829.44f, 32.3662f }, 40 | { "Trevor's Safehouse 2", -1157.05f, -1512.73f, 4.2127f }, 41 | { "Trevor's Safehouse 3", 91.1407f, -1280.65f, 29.1353f }, 42 | { "Michael's Safehouse Inside", -813.603f, 179.474f, 72.1548f }, 43 | { "Franklin's Safehouse Inside", -14.3803f, -1438.51f, 31.1073f }, 44 | { "Franklin's Safehouse 2 Inside", 7.11903f, 536.615f, 176.028f }, 45 | { "Trevor's Safehouse Inside", 1972.61f, 3817.04f, 33.4278f }, 46 | { "Trevor's Safehouse 2 Inside", -1151.77f, -1518.14f, 10.6327f }, 47 | { "Trevor's Safehouse 3 Inside", 96.1536f, -1290.73f, 29.2664f }, 48 | }; 49 | 50 | std::vector LOCATIONS_LANDMARKS = { 51 | { "Airport Entrance", -1034.6f, -2733.6f, 13.8f }, 52 | { "Airport Field", -1336.0f, -3044.0f, 13.9f }, 53 | { "Altruist Cult Camp", -1170.841f, 4926.646f, 224.295f }, 54 | { "Calafia Train Bridge", -517.869f, 4425.284f, 89.795f }, 55 | { "Cargo Ship", 899.678f, -2882.191f, 19.013f }, 56 | { "Chumash", -3192.6f, 1100.0f, 20.2f }, 57 | { "Chumash Historic Family Pier", -3426.683f, 967.738f, 8.347f }, 58 | { "Del Perro Pier", -1850.127f, -1231.751f, 13.017f }, 59 | { "Devin Weston's House", -2639.872f, 1866.812f, 160.135f }, 60 | { "El Burro Heights", 1384.0f, -2057.1f, 52.0f }, 61 | { "Elysian Island", 338.2f, -2715.9f, 38.5f }, 62 | { "Far North San Andreas", 24.775f, 7644.102f, 19.055f }, 63 | { "Ferris Wheel", -1670.7f, -1125.0f, 13.0f }, 64 | { "Fort Zancudo", -2047.4f, 3132.1f, 32.8f }, 65 | { "Fort Zancudo ATC Entrance", -2344.373f, 3267.498f, 32.811f }, 66 | { "Fort Zancudo ATC Top Floor", -2358.132f, 3249.754f, 101.451f }, 67 | { "God's Thumb", -1006.402f, 6272.383f, 1.503f }, 68 | { "Hippy Camp", 2476.712f, 3789.645f, 41.226f }, 69 | { "Jetsam", 760.4f, -2943.2f, 5.8f }, 70 | { "Jolene Cranley-Evans Ghost", 3059.620f, 5564.246f, 197.091f }, 71 | { "Kortz Center", -2243.810f, 264.048f, 174.615f }, 72 | { "Main LS Customs", -365.425f, -131.809f, 37.873f }, 73 | { "Marlowe Vineyards", -1868.971f, 2095.674f, 139.115f }, 74 | { "McKenzie Airfield", 2121.7f, 4796.3f, 41.1f }, 75 | { "Merryweather Dock", 486.417f, -3339.692f, 6.070f }, 76 | { "Mineshaft", -595.342f, 2086.008f, 131.412f }, 77 | { "Mt. Chiliad", 425.4f, 5614.3f, 766.5f }, 78 | { "Mt. Chiliad Summit", 450.718f, 5566.614f, 806.183f }, 79 | { "NOOSE Headquarters", 2535.243f, -383.799f, 92.993f }, 80 | { "Pacific Standard Bank", 235.046f, 216.434f, 106.287f }, 81 | { "Paleto Bay Pier", -275.522f, 6635.835f, 7.425f }, 82 | { "Playboy Mansion", -1475.234f, 167.088f, 55.841f }, 83 | { "Police Station", 436.491f, -982.172f, 30.699f }, 84 | { "Quarry", 2954.196f, 2783.410f, 41.004f }, 85 | { "Sandy Shores Airfield", 1747.0f, 3273.7f, 41.1f }, 86 | { "Satellite Dishes", 2062.123f, 2942.055f, 47.431f }, 87 | { "Sisyphus Theater Stage", 686.245f, 577.950f, 130.461f }, 88 | { "Trevor's Meth Lab", 1391.773f, 3608.716f, 38.942f }, 89 | { "Weed Farm", 2208.777f, 5578.235f, 53.735f }, 90 | { "Wind Farm", 2354.0f, 1830.3f, 101.1f } 91 | }; 92 | 93 | // Extra locations coordinates source: "PulseR_HD" @ http://gtaforums.com/topic/789786-vrelwip-simple-trainer-enhancements-skin-detail-chooser-menu-architecture/?p=1067398379 94 | 95 | std::vector LOCATIONS_HIGH = { 96 | { "Airplane Graveyard Airplane Tail ", 2395.096f, 3049.616f, 60.053f }, 97 | { "FIB Building Roof", 150.126f, -754.591f, 262.865f }, 98 | { "Galileo Observatory Roof", -438.804f, 1076.097f, 352.411f }, 99 | { "IAA Building Roof", 134.085f, -637.859f, 262.851f }, 100 | { "Maze Bank Arena Roof", -324.300f, -1968.545f, 67.002f }, 101 | { "Maze Bank Roof", -75.015f, -818.215f, 326.176f }, 102 | { "Palmer-Taylor Power Station Chimney", 2732.931f, 1577.540f, 83.671f }, 103 | { "Rebel Radio", 736.153f, 2583.143f, 79.634f }, 104 | { "Sandy Shores Building Site Crane", 1051.209f, 2280.452f, 89.727f }, 105 | { "Satellite Dish Antenna", 2034.988f, 2953.105f, 74.602f }, 106 | { "Stab City", 126.975f, 3714.419f, 46.827f }, 107 | { "Very High Up", -129.964f, 8130.873f, 6705.307f }, 108 | { "Windmill Top", 2026.677f, 1842.684f, 133.313f } 109 | }; 110 | 111 | std::vector LOCATIONS_UNDERWATER = { 112 | { "Dead Sea Monster", -3373.726f, 504.714f, -24.656f }, 113 | { "Humane Labs Tunnel", 3619.749f, 2742.740f, 28.690f }, 114 | { "Sunken Body", -3161.078f, 3001.998f, -37.974f }, 115 | { "Sunken Cargo Ship", 3199.748f, -379.018f, -22.500f }, 116 | { "Sunken Plane", -942.350f, 6608.752f, -20.912f }, 117 | { "Underwater Hatch", 4273.950f, 2975.714f, -170.746f }, 118 | { "Underwater UFO", 762.426f, 7380.371f, -111.377f }, 119 | { "Underwater WW2 Tank", 4201.633f, 3643.821f, -39.016f }, 120 | }; 121 | 122 | std::vector LOCATIONS_INTERIORS = { 123 | { "10 Car Garage Back Room", 223.193f, -967.322f, -99.000f }, 124 | { "10 Car Garage Bay", 228.135f, -995.350f, -99.000f }, 125 | { "Ammunation Gun Range", 22.153f, -1072.854f, 29.797f }, 126 | { "Ammunation Office", 12.494f, -1110.130f, 29.797f }, 127 | { "Bahama Mamas West", -1387.08f, -588.4f, 30.3195f }, 128 | { "Blaine County Savings Bank", -109.299f, 6464.035f, 31.627f }, 129 | { "Clucking Bell Farms Warehouse", -70.0624f, 6263.53f, 31.0909f, { "CS1_02_cf_onmission1", "CS1_02_cf_onmission2", "CS1_02_cf_onmission3", "CS1_02_cf_onmission4" }, { "CS1_02_cf_offmission" }, false }, 130 | { "Control Office", 1080.97f, -1976.0f, 31.4721f }, 131 | { "Devin's Garage", 482.027f, -1317.96f, 29.2021f }, 132 | { "Eclipse Apartment 5", -762.762f, 322.634f, 175.401f }, 133 | { "Eclipse Apartment 9", -790.673f, 334.468f, 158.599f }, 134 | { "Eclipse Apartment 31", -762.762f, 322.634f, 221.855f }, 135 | { "Eclipse Apartment 40", -790.673f, 334.468f, 206.218f }, 136 | { "FIB Building Burnt", 159.553f, -738.851f, 246.152f }, 137 | { "FIB Building Floor 47", 134.573f, -766.486f, 234.152f }, 138 | { "FIB Building Floor 49", 134.635f, -765.831f, 242.152f }, 139 | { "FIB Building Lobby", 110.4f, -744.2f, 45.7f, { "FIBlobby" }, { "FIBlobbyfake" } }, 140 | { "FIB Building Top Floor", 135.733f, -749.216f, 258.152f }, 141 | { "Garment Factory", 717.397f, -965.572f, 30.3955f }, 142 | { "Hospital (Destroyed)", 302.651f, -586.293f, 43.3129f, { "RC12B_Destroyed", "RC12B_HospitalInterior" }, { "RC12B_Default", "RC12B_Fixed" }, false }, 143 | { "Humane Labs Lower Level", 3525.495f, 3705.301f, 20.992f }, 144 | { "Humane Labs Upper Level", 3618.52f, 3755.76f, 28.6901f }, 145 | { "IAA Office", 117.220f, -620.938f, 206.047f }, 146 | { "Ice Planet Jewelery", 243.516f, 364.099f, 105.738f }, 147 | { "Janitor's Apartment", -110.721f, -8.22095f, 70.5197f }, 148 | { "Jewel Store", -630.07f, -236.332f, 38.0571f, { "post_hiest_unload" }, { "jewel2fake", "bh1_16_refurb" }, false }, 149 | { "Lester's House", 1273.898f, -1719.304f, 54.771f }, 150 | { "Life Invader Office", -1049.13f, -231.779f, 39.0144f, { "facelobby" }, { "facelobbyfake" }, false }, 151 | { "Maze Bank Arena", -254.918f, -2019.75f, 30.1456f }, 152 | { "Morgue", 275.446f, -1361.11f, 24.5378f, { "Coroner_Int_on" }, {}, false }, 153 | { "O'Neil Farm", 2454.78f, 4971.92f, 46.8103f, { "farm", "farm_props", "farmint" }, { "farm_burnt", "farm_burnt_props", "farmint_cap" }, false }, 154 | { "Pacific Standard Bank Vault", 255.851f, 217.030f, 101.683f }, 155 | { "Paleto Bay Sheriff", -446.135f, 6012.91f, 31.7164f }, 156 | { "Raven Slaughterhouse", 967.357f, -2184.71f, 30.0613f }, 157 | { "Rogers Salvage & Scrap", -609.962f, -1612.49f, 27.0105f }, 158 | { "Sandy Shores Sheriff", 1853.18f, 3686.63f, 34.2671f }, 159 | { "Simeon's Dealership", -56.4951f, -1095.8f, 26.4224f }, 160 | { "Split Sides West Comedy Club", -564.261f, 278.232f, 83.1364f }, 161 | { "Strip Club DJ Booth", 126.135f, -1278.583f, 29.270f }, 162 | { "Torture Warehouse", 136.514f, -2203.15f, 7.30914f }, 163 | 164 | }; 165 | 166 | std::vector IPLS_CARRIER = { 167 | "hei_carrier", 168 | "hei_carrier_DistantLights", 169 | "hei_Carrier_int1", 170 | "hei_Carrier_int2", 171 | "hei_Carrier_int3", 172 | "hei_Carrier_int4", 173 | "hei_Carrier_int5", 174 | "hei_Carrier_int6", 175 | "hei_carrier_LODLights" 176 | }; 177 | 178 | std::vector IPLS_HEISTYACHT = { 179 | "hei_yacht_heist", 180 | "hei_yacht_heist_Bar", 181 | "hei_yacht_heist_Bedrm", 182 | "hei_yacht_heist_Bridge", 183 | "hei_yacht_heist_DistantLights", 184 | "hei_yacht_heist_enginrm", 185 | "hei_yacht_heist_LODLights", 186 | "hei_yacht_heist_Lounge" 187 | }; 188 | 189 | std::vector IPLS_NORTH_YANKTON = { 190 | "plg_01", 191 | "prologue01", 192 | "prologue01_lod", 193 | "prologue01c", 194 | "prologue01c_lod", 195 | "prologue01d", 196 | "prologue01d_lod", 197 | "prologue01e", 198 | "prologue01e_lod", 199 | "prologue01f", 200 | "prologue01f_lod", 201 | "prologue01g", 202 | "prologue01h", 203 | "prologue01h_lod", 204 | "prologue01i", 205 | "prologue01i_lod", 206 | "prologue01j", 207 | "prologue01j_lod", 208 | "prologue01k", 209 | "prologue01k_lod", 210 | "prologue01z", 211 | "prologue01z_lod", 212 | "plg_02", 213 | "prologue02", 214 | "prologue02_lod", 215 | "plg_03", 216 | "prologue03", 217 | "prologue03_lod", 218 | "prologue03b", 219 | "prologue03b_lod", 220 | "prologue03_grv_dug", 221 | "prologue03_grv_dug_lod", 222 | "prologue_grv_torch", 223 | "plg_04", 224 | "prologue04", 225 | "prologue04_lod", 226 | "prologue04b", 227 | "prologue04b_lod", 228 | "prologue04_cover", 229 | "des_protree_end", 230 | "des_protree_start", 231 | "des_protree_start_lod", 232 | "plg_05", 233 | "prologue05", 234 | "prologue05_lod", 235 | "prologue05b", 236 | "prologue05b_lod", 237 | "plg_06", 238 | "prologue06", 239 | "prologue06_lod", 240 | "prologue06b", 241 | "prologue06b_lod", 242 | "prologue06_int", 243 | "prologue06_int_lod", 244 | "prologue06_pannel", 245 | "prologue06_pannel_lod", 246 | "plg_occl_00", 247 | "prologue_occl", 248 | "plg_rd", 249 | "prologuerd", 250 | "prologuerdb", 251 | "prologuerd_lod" 252 | }; 253 | 254 | std::vector LOCATIONS_REQSCEN = { 255 | { "Carrier", 3069.330f, -4632.4f, 15.043f }, 256 | { "Fort Zancudo UFO", -2052.000f, 3237.000f, 1456.973f, { "ufo", "ufo_lod", "ufo_eye" }, {}, false }, 257 | { "North Yankton", 3360.19f, -4849.67f, 111.8f, IPLS_NORTH_YANKTON, {}, false }, 258 | { "North Yankton Bank", 5309.519f, -5212.375f, 83.522f, IPLS_NORTH_YANKTON, {}, false }, 259 | { "SS Bulker (Intact)", -163.749f, -2377.94f, 9.3192f, { "cargoship" }, { "sunkcargoship" }, false }, 260 | { "SS Bulker (Sunk)", -162.8918f, -2365.769f, 0.0f, { "sunkcargoship" }, { "cargoship" }, false }, 261 | { "Train Crash Bridge", -532.1309f, 4526.187f, 88.7955f, { "canyonriver01_traincrash", "railing_end" }, { "railing_start", "canyonriver01" }, false }, 262 | { "Yacht", -2023.661f, -1038.038f, 5.577f }, 263 | }; 264 | 265 | std::vector MENU_LOCATION_CATEGORIES{ "Safehouses", "Landmarks", "Roof/High Up", "Underwater", "Interiors", "Extra Exterior Scenery" }; 266 | 267 | std::vector VOV_LOCATIONS[] = { LOCATIONS_SAFE, LOCATIONS_LANDMARKS, LOCATIONS_HIGH, LOCATIONS_UNDERWATER, LOCATIONS_INTERIORS, LOCATIONS_REQSCEN }; 268 | 269 | void teleport_to_coords(Entity e, Vector3 coords) 270 | { 271 | ENTITY::SET_ENTITY_COORDS_NO_OFFSET(e, coords.x, coords.y, coords.z, 0, 0, 1); 272 | WAIT(0); 273 | set_status_text("Teleported"); 274 | } 275 | 276 | void output_current_location(Entity e) 277 | { 278 | Vector3 coords = ENTITY::GET_ENTITY_COORDS(e, 0); 279 | 280 | std::ostringstream ss; 281 | ss << "X: " << coords.x << "\nY: " << coords.y << "\nZ: " << coords.z; 282 | 283 | set_status_text_centre_screen(ss.str(), 4000UL); 284 | } 285 | 286 | void teleport_to_marker(Entity e) 287 | { 288 | Vector3 coords; 289 | bool success = false; 290 | bool blipFound = false; 291 | int blipIterator = UI::_GET_BLIP_INFO_ID_ITERATOR(); 292 | 293 | for (Blip i = UI::GET_FIRST_BLIP_INFO_ID(blipIterator); UI::DOES_BLIP_EXIST(i) != 0; i = UI::GET_NEXT_BLIP_INFO_ID(blipIterator)) 294 | { 295 | if (UI::GET_BLIP_INFO_ID_TYPE(i) == 4) 296 | { 297 | coords = UI::GET_BLIP_INFO_ID_COORD(i); 298 | blipFound = true; 299 | break; 300 | } 301 | } 302 | if (blipFound) 303 | { 304 | // get entity to teleport 305 | Entity e = PLAYER::PLAYER_PED_ID(); 306 | if (PED::IS_PED_IN_ANY_VEHICLE(e, 0)) 307 | { 308 | e = PED::GET_VEHICLE_PED_IS_USING(e); 309 | } 310 | 311 | // load needed map region and check height levels for ground existence 312 | bool groundFound = false; 313 | static float groundCheckHeight[] = { 314 | 100.0, 150.0, 50.0, 0.0, 200.0, 250.0, 300.0, 350.0, 400.0, 315 | 450.0, 500.0, 550.0, 600.0, 650.0, 700.0, 750.0, 800.0 316 | }; 317 | for (int i = 0; i < sizeof(groundCheckHeight) / sizeof(float); i++) 318 | { 319 | ENTITY::SET_ENTITY_COORDS_NO_OFFSET(e, coords.x, coords.y, groundCheckHeight[i], 0, 0, 1); 320 | WAIT(100); 321 | if (GAMEPLAY::GET_GROUND_Z_FOR_3D_COORD(coords.x, coords.y, groundCheckHeight[i], &coords.z)) 322 | { 323 | groundFound = true; 324 | coords.z += 3.0; 325 | break; 326 | } 327 | } 328 | 329 | // if ground not found then set Z in air and give player a parachute 330 | if (!groundFound) 331 | { 332 | coords.z = 1000.0; 333 | WEAPON::GIVE_DELAYED_WEAPON_TO_PED(PLAYER::PLAYER_PED_ID(), 0xFBAB5776, 1, 0); 334 | } 335 | 336 | //do it 337 | teleport_to_coords(e, coords); 338 | } 339 | else 340 | { 341 | set_status_text("Map marker not found"); 342 | } 343 | } 344 | 345 | bool onconfirm_teleport_category(MenuItem choice) 346 | { 347 | Entity e = PLAYER::PLAYER_PED_ID(); 348 | if (choice.value == -2) 349 | { 350 | teleport_to_marker(e); 351 | return false; 352 | } 353 | else if (choice.value == -1) 354 | { 355 | output_current_location(e); 356 | return false; 357 | } 358 | 359 | lastChosenCategory = choice.value; 360 | 361 | if (process_teleport_menu(lastChosenCategory)) 362 | { 363 | return true; 364 | } 365 | return false; 366 | } 367 | 368 | bool onconfirm_teleport_location(MenuItem choice) 369 | { 370 | lastMenuChoiceInCategories[lastChosenCategory] = choice.value; 371 | 372 | tele_location* value = &VOV_LOCATIONS[lastChosenCategory][choice.value]; 373 | 374 | // get entity to teleport 375 | Entity e = PLAYER::PLAYER_PED_ID(); 376 | if (PED::IS_PED_IN_ANY_VEHICLE(e, 0)) 377 | { 378 | e = PED::GET_VEHICLE_PED_IS_USING(e); 379 | } 380 | 381 | Vector3 coords; 382 | 383 | if ((value->scenery_required.size() > 0 || value->scenery_toremove.size() > 0) && !value->isLoaded) 384 | { 385 | set_status_text("Loading scenery..."); 386 | 387 | if ( ENTITY::DOES_ENTITY_EXIST ( PLAYER::PLAYER_PED_ID () ) )// && STREAMING::IS_IPL_ACTIVE("plg_01") == 0) 388 | { 389 | for (const char* scenery : value->scenery_toremove) 390 | { 391 | if (STREAMING::IS_IPL_ACTIVE(scenery)) 392 | { 393 | STREAMING::REMOVE_IPL(scenery); 394 | } 395 | } 396 | for ( const char* scenery : value->scenery_required ) 397 | { 398 | if (!STREAMING::IS_IPL_ACTIVE(scenery)) 399 | { 400 | STREAMING::REQUEST_IPL(scenery); 401 | } 402 | } 403 | } 404 | 405 | value->isLoaded = true; 406 | 407 | DWORD time = GetTickCount() + 1000; 408 | while (GetTickCount() < time) 409 | { 410 | make_periodic_feature_call(); 411 | WAIT(0); 412 | } 413 | 414 | set_status_text("Scenery loaded"); 415 | 416 | time = GetTickCount() + 1000; 417 | while (GetTickCount() < time) 418 | { 419 | make_periodic_feature_call(); 420 | WAIT(0); 421 | } 422 | } 423 | 424 | coords.x = value->x; 425 | coords.y = value->y; 426 | coords.z = value->z; 427 | teleport_to_coords(e, coords); 428 | 429 | bool unloadedAnything = false; 430 | DWORD time = GetTickCount() + 1000; 431 | 432 | for (int x = 0; x < MENU_LOCATION_CATEGORIES.size(); x++) 433 | { 434 | for (int y = 0; y < VOV_LOCATIONS[x].size(); y++) 435 | { 436 | //don't unload our newly loaded scenery 437 | if (x == lastChosenCategory && y == choice.value) 438 | { 439 | continue; 440 | } 441 | 442 | tele_location* loc = &VOV_LOCATIONS[x][y]; 443 | 444 | //don't unload something using same loader 445 | if (loc->scenery_required == value->scenery_required && loc->scenery_toremove == value->scenery_toremove) 446 | { 447 | continue; 448 | } 449 | 450 | if (loc->isLoaded && loc->scenery_required.size() > 0) 451 | { 452 | if (!unloadedAnything) 453 | { 454 | set_status_text("Unloading old scenery..."); 455 | time = GetTickCount() + 1000; 456 | while (GetTickCount() < time) 457 | { 458 | make_periodic_feature_call(); 459 | WAIT(0); 460 | } 461 | } 462 | 463 | if ( ENTITY::DOES_ENTITY_EXIST ( PLAYER::PLAYER_PED_ID () ) )// && STREAMING::IS_IPL_ACTIVE("plg_01") == 1) 464 | { 465 | for ( const char* scenery : loc->scenery_required ) 466 | { 467 | if (STREAMING::IS_IPL_ACTIVE(scenery)) 468 | { 469 | STREAMING::REMOVE_IPL(scenery); 470 | } 471 | } 472 | for (const char* scenery : loc->scenery_toremove) 473 | { 474 | if (!STREAMING::IS_IPL_ACTIVE(scenery)) 475 | { 476 | STREAMING::REQUEST_IPL(scenery); 477 | } 478 | } 479 | } 480 | 481 | unloadedAnything = true; 482 | loc->isLoaded = false; 483 | } 484 | } 485 | } 486 | 487 | if (unloadedAnything) 488 | { 489 | set_status_text("Old scenery unloaded"); 490 | 491 | time = GetTickCount() + 1000; 492 | while (GetTickCount() < time) 493 | { 494 | make_periodic_feature_call(); 495 | WAIT(0); 496 | } 497 | } 498 | 499 | return false; 500 | } 501 | 502 | bool process_teleport_menu(int categoryIndex) 503 | { 504 | if (categoryIndex == -1) 505 | { 506 | MenuItemVector menuItems; 507 | 508 | MenuItem markerItem; 509 | markerItem.caption = "Teleport to waypoint"; 510 | markerItem.value = -2; 511 | markerItem.isLeaf = true; 512 | menuItems.push_back(markerItem); 513 | 514 | MenuItem dialogItem; 515 | dialogItem.caption = "Show coordinates"; 516 | dialogItem.value = -1; 517 | dialogItem.isLeaf = true; 518 | menuItems.push_back(dialogItem); 519 | 520 | for (int i = 0; i < MENU_LOCATION_CATEGORIES.size(); i++) 521 | { 522 | MenuItem item; 523 | item.caption = MENU_LOCATION_CATEGORIES[i]; 524 | item.value = i; 525 | item.isLeaf = false; 526 | menuItems.push_back(item); 527 | } 528 | 529 | bool result = draw_generic_menu(menuItems, &mainMenuIndex, "Locations", onconfirm_teleport_category, NULL, NULL); 530 | return result; 531 | } 532 | else 533 | { 534 | MenuItemVector menuItems; 535 | 536 | for (int i = 0; i < VOV_LOCATIONS[categoryIndex].size(); i++) 537 | { 538 | MenuItem item; 539 | item.caption = VOV_LOCATIONS[categoryIndex][i].text; 540 | item.value = i; 541 | menuItems.push_back(item); 542 | } 543 | 544 | return draw_generic_menu(menuItems, &lastMenuChoiceInCategories[lastChosenCategory], "Locations", onconfirm_teleport_location, NULL, NULL); 545 | } 546 | } 547 | 548 | void reset_teleporter_globals() 549 | { 550 | for (int i = 0; i < MENU_LOCATION_CATEGORIES.size(); i++) 551 | { 552 | lastMenuChoiceInCategories[i] = 0; 553 | } 554 | lastChosenCategory = 0; 555 | } -------------------------------------------------------------------------------- /LambdaMenu/paintmenu.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Lambda Menu 3 | * (C) Oui 2017 4 | * https://lambda.menu 5 | * 6 | * The trainer menu code was based on the Enhanced Native Trainer project. 7 | * https://github.com/gtav-ent/GTAV-EnhancedNativeTrainer 8 | * (C) Rob Pridham and fellow contributors 2015 9 | * 10 | * Some of this code began its life as a part of GTA V SCRIPT HOOK SDK. 11 | * http://dev-c.com 12 | * (C) Alexander Blade 2015 13 | */ 14 | 15 | #include "vehicles.h" 16 | #include "menu_functions.h" 17 | #include "config_io.h" 18 | 19 | extern int whichpart = 0; 20 | extern int whichtype = 0; 21 | 22 | //Parts 23 | const std::vector MENU_PAINT_WHAT{ "Primary Color", "Secondary Color", "Primary & Secondary", "Pearl Topcoat", "Wheels" }; 24 | 25 | //Paint Names 26 | const std::vector MENU_PAINT_TYPE{ "Normal", "Metallic", "Matte", "Metal", "Chrome" }; 27 | 28 | const std::vector PAINTS_NORMAL{ 29 | { "Black", 0, 0 }, 30 | { "Carbon Black", 147, 0 }, 31 | { "Graphite Black", 1, 0 }, 32 | { "Anthracite Black", 11, 0 }, 33 | { "Black Steel", 2, 0 }, 34 | { "Dark Steel", 3, 2 }, 35 | { "Silver", 4, 4 }, 36 | { "Bluish Silver", 5, 5 }, 37 | { "Rolled Steel", 6, 0 }, 38 | { "Shadow Silver", 7, 0 }, 39 | { "Stone Silver", 8, 0 }, 40 | { "Midnight Silver", 9, 0 }, 41 | { "Cast Iron Silver", 10, 0 }, 42 | { "Red", 27, 0 }, 43 | { "Torino Red", 28, 0 }, 44 | { "Formula Red", 29, 0 }, 45 | { "Lava Red", 150, 0 }, 46 | { "Blaze Red", 30, 0 }, 47 | { "Grace Red", 31, 0 }, 48 | { "Garnet Red", 32, 0 }, 49 | { "Sunset Red", 33, 0 }, 50 | { "Cabernet Red", 34, 0 }, 51 | { "Wine Red", 143, 0 }, 52 | { "Candy Red", 35, 0 }, 53 | { "Hot Pink", 135, 0 }, 54 | { "Pfister Pink", 137, 0 }, 55 | { "Salmon Pink", 136, 0 }, 56 | { "Sunrise Orange", 36, 0 }, 57 | { "Orange", 38, 0 }, 58 | { "Bright Orange", 138, 0 }, 59 | { "Gold", 99, 99 }, 60 | { "Bronze", 90, 102 }, 61 | { "Yellow", 88, 0 }, 62 | { "Race Yellow", 89, 0 }, 63 | { "Dew Yellow", 91, 0 }, 64 | { "Dark Green", 49, 0 }, 65 | { "Racing Green", 50, 0 }, 66 | { "Sea Green", 51, 0 }, 67 | { "Olive Green", 52, 0 }, 68 | { "Bright Green", 53, 0 }, 69 | { "Gasoline Green", 54, 0 }, 70 | { "Lime Green", 92, 0 }, 71 | { "Midnight Blue", 141, 0 }, 72 | { "Galaxy Blue", 61, 0 }, 73 | { "Dark Blue", 62, 0 }, 74 | { "Saxon Blue", 63, 0 }, 75 | { "Blue", 64, 0 }, 76 | { "Mariner Blue", 65, 0 }, 77 | { "Harbor Blue", 66, 0 }, 78 | { "Diamond Blue", 67, 0 }, 79 | { "Surf Blue", 68, 0 }, 80 | { "Nautical Blue", 69, 0 }, 81 | { "Racing Blue", 73, 0 }, 82 | { "Ultra Blue", 70, 0 }, 83 | { "Light Blue", 74, 0 }, 84 | { "Chocolate Brown", 96, 0 }, 85 | { "Bison Brown", 101, 0 }, 86 | { "Creek Brown", 95, 0 }, 87 | { "Feltzer Brown", 94, 0 }, 88 | { "Maple Brown", 97, 0 }, 89 | { "Beechwood Brown", 103, 0 }, 90 | { "Sienna Brown", 104, 0 }, 91 | { "Saddle Brown", 98, 0 }, 92 | { "Moss Brown", 100, 0 }, 93 | { "Woodbeech Brown", 102, 0 }, 94 | { "Straw Brown", 99, 0 }, 95 | { "Sandy Brown", 105, 0 }, 96 | { "Bleached Brown", 106, 0 }, 97 | { "Schafter Purple", 71, 0 }, 98 | { "Spinnaker Purple", 72, 0 }, 99 | { "Midnight Purple", 142, 0 }, 100 | { "Bright Purple", 145, 0 }, 101 | { "Cream", 107, 0 }, 102 | { "Ice White", 111, 0 }, 103 | { "Frost White", 112, 0 } 104 | }; 105 | 106 | const std::vector PAINTS_METALLIC{ 107 | { "Black", 0, 10 }, 108 | { "Carbon Black", 147, 4 }, 109 | { "Graphite Black", 1, 5 }, 110 | { "Anthracite Black", 11, 2 }, 111 | { "Black Steel", 2, 5 }, 112 | { "Dark Steel", 3, 6 }, 113 | { "Silver", 4, 111 }, 114 | { "Bluish Silver", 5, 111 }, 115 | { "Rolled Steel", 6, 4 }, 116 | { "Shadow Silver", 7, 5 }, 117 | { "Stone Silver", 8, 5 }, 118 | { "Midnight Silver", 9, 7 }, 119 | { "Cast Iron Silver", 10, 7 }, 120 | { "Red", 27, 36 }, 121 | { "Torino Red", 28, 28 }, 122 | { "Formula Red", 29, 28 }, 123 | { "Lava Red", 150, 42 }, 124 | { "Blaze Red", 30, 36 }, 125 | { "Grace Red", 31, 27 }, 126 | { "Garnet Red", 32, 25 }, 127 | { "Sunset Red", 33, 47 }, 128 | { "Cabernet Red", 34, 47 }, 129 | { "Wine Red", 143, 31 }, 130 | { "Candy Red", 35, 25 }, 131 | { "Hot Pink", 135, 135 }, 132 | { "Pfister Pink", 137, 3 }, 133 | { "Salmon Pink", 136, 5 }, 134 | { "Sunrise Orange", 36, 26 }, 135 | { "Orange", 38, 37 }, 136 | { "Bright Orange", 138, 89 }, 137 | { "Gold", 37, 106 }, 138 | { "Bronze", 90, 102 }, 139 | { "Yellow", 88, 88 }, 140 | { "Race Yellow", 89, 88 }, 141 | { "Dew Yellow", 91, 91 }, 142 | { "Dark Green", 49, 52 }, 143 | { "Racing Green", 50, 53 }, 144 | { "Sea Green", 51, 66 }, 145 | { "Olive Green", 52, 59 }, 146 | { "Bright Green", 53, 59 }, 147 | { "Gasoline Green", 54, 60 }, 148 | { "Lime Green", 92, 92 }, 149 | { "Midnight Blue", 141, 73 }, 150 | { "Galaxy Blue", 61, 63 }, 151 | { "Dark Blue", 62, 68 }, 152 | { "Saxon Blue", 63, 87 }, 153 | { "Blue", 64, 68 }, 154 | { "Mariner Blue", 65, 87 }, 155 | { "Harbor Blue", 66, 60 }, 156 | { "Diamond Blue", 67, 67 }, 157 | { "Surf Blue", 68, 68 }, 158 | { "Nautical Blue", 69, 74 }, 159 | { "Racing Blue", 73, 73 }, 160 | { "Ultra Blue", 70, 70 }, 161 | { "Light Blue", 74, 74 }, 162 | { "Chocolate Brown", 96, 95 }, 163 | { "Bison Brown", 101, 95 }, 164 | { "Creek Brown", 95, 97 }, 165 | { "Feltzer Brown", 94, 104 }, 166 | { "Maple Brown", 97, 98 }, 167 | { "Beechwood Brown", 103, 104 }, 168 | { "Sienna Brown", 104, 104 }, 169 | { "Saddle Brown", 98, 95 }, 170 | { "Moss Brown", 100, 100 }, 171 | { "Woodbeech Brown", 102, 105 }, 172 | { "Straw Brown", 99, 106 }, 173 | { "Sandy Brown", 105, 105 }, 174 | { "Bleached Brown", 106, 106 }, 175 | { "Schafter Purple", 71, 145 }, 176 | { "Spinnaker Purple", 72, 64 }, 177 | { "Midnight Purple", 146, 145 }, 178 | { "Bright Purple", 145, 74 }, 179 | { "Cream", 107, 107 }, 180 | { "Ice White", 111, 0 }, 181 | { "Frost White", 112, 0 } 182 | }; 183 | 184 | const std::vector PAINTS_MATTE{ 185 | { "Black", 12, 0 }, 186 | { "Gray", 13, 0 }, 187 | { "Light Gray", 14, 0 }, 188 | { "Ice White", 131, 0 }, 189 | { "Blue", 83, 0 }, 190 | { "Dark Blue", 82, 0 }, 191 | { "Midnight Blue", 84, 0 }, 192 | { "Midnight Purple", 149, 0 }, 193 | { "Schafter Purple", 148, 0 }, 194 | { "Red", 39, 0 }, 195 | { "Dark Red", 40, 0 }, 196 | { "Orange", 41, 0 }, 197 | { "Yellow", 42, 0 }, 198 | { "Lime Green", 55, 0 }, 199 | { "Green", 128, 0 }, 200 | { "Forest Green", 151, 0 }, 201 | { "Foliage Green", 155, 0 }, 202 | { "Olive Drab", 152, 0 }, 203 | { "Dark Earth", 153, 0 }, 204 | { "Desert Tan", 154, 0 } 205 | }; 206 | 207 | const std::vector PAINTS_METAL{ 208 | { "Brushed Steel", 117, 18 }, 209 | { "Brushed Black Steel", 118, 3 }, 210 | { "Brushed Aluminum", 119, 5 }, 211 | { "Pure Gold", 158, 160 }, 212 | { "Brushed Gold", 159, 160 } 213 | }; 214 | 215 | const std::vector PAINTS_PEARL{ 216 | { "Black", -1, 0 }, 217 | { "Carbon Black", -1, 147 }, 218 | { "Graphite Black", -1, 1 }, 219 | { "Anthracite Black", -1, 11 }, 220 | { "Black Steel", -1, 2 }, 221 | { "Dark Steel", -1, 3 }, 222 | { "Silver", -1, 4 }, 223 | { "Bluish Silver", -1, 5 }, 224 | { "Rolled Steel", -1, 6 }, 225 | { "Shadow Silver", -1, 7 }, 226 | { "Stone Silver", -1, 8 }, 227 | { "Midnight Silver", -1, 9 }, 228 | { "Cast Iron Silver", -1, 10 }, 229 | { "Red", -1, 27 }, 230 | { "Torino Red", -1, 28 }, 231 | { "Formula Red", -1, 29 }, 232 | { "Lava Red", -1, 150 }, 233 | { "Blaze Red", -1, 30 }, 234 | { "Grace Red", -1, 31 }, 235 | { "Garnet Red", -1, 32 }, 236 | { "Sunset Red", -1, 33 }, 237 | { "Cabernet Red", -1, 34 }, 238 | { "Wine Red", -1, 143 }, 239 | { "Candy Red", -1, 35 }, 240 | { "Hot Pink", -1, 135 }, 241 | { "Pfister Pink", -1, 137 }, 242 | { "Salmon Pink", -1, 136 }, 243 | { "Sunrise Orange", -1, 36 }, 244 | { "Orange", -1, 38 }, 245 | { "Bright Orange", -1, 138 }, 246 | { "Gold", -1, 37 }, 247 | { "Bronze", -1, 90 }, 248 | { "Yellow", -1, 88 }, 249 | { "Race Yellow", -1, 89 }, 250 | { "Dew Yellow", -1, 91 }, 251 | { "Dark Green", -1, 49 }, 252 | { "Racing Green", -1, 50 }, 253 | { "Sea Green", -1, 51 }, 254 | { "Olive Green", -1, 52 }, 255 | { "Bright Green", -1, 53 }, 256 | { "Gasoline Green", -1, 54 }, 257 | { "Lime Green", -1, 92 }, 258 | { "Midnight Blue", -1, 141 }, 259 | { "Galaxy Blue", -1, 61 }, 260 | { "Dark Blue", -1, 62 }, 261 | { "Saxon Blue", -1, 63 }, 262 | { "Blue", -1, 64 }, 263 | { "Mariner Blue", -1, 65 }, 264 | { "Harbor Blue", -1, 66 }, 265 | { "Diamond Blue", -1, 67 }, 266 | { "Surf Blue", -1, 68 }, 267 | { "Nautical Blue", -1, 69 }, 268 | { "Racing Blue", -1, 73 }, 269 | { "Ultra Blue", -1, 70 }, 270 | { "Light Blue", -1, 74 }, 271 | { "Chocolate Brown", -1, 96 }, 272 | { "Bison Brown", -1, 101 }, 273 | { "Creek Brown", -1, 95 }, 274 | { "Feltzer Brown", -1, 94 }, 275 | { "Maple Brown", -1, 97 }, 276 | { "Beechwood Brown", -1, 103 }, 277 | { "Sienna Brown", -1, 104 }, 278 | { "Saddle Brown", -1, 98 }, 279 | { "Moss Brown", -1, 100 }, 280 | { "Woodbeech Brown", -1, 102 }, 281 | { "Straw Brown", -1, 99 }, 282 | { "Sandy Brown", -1, 105 }, 283 | { "Bleached Brown", -1, 106 }, 284 | { "Schafter Purple", -1, 71 }, 285 | { "Spinnaker Purple", -1, 72 }, 286 | { "Midnight Purple", -1, 146 }, 287 | { "Bright Purple", -1, 145 }, 288 | { "Cream", -1, 107 }, 289 | { "Ice White", -1, 111 }, 290 | { "Frost White", -1, 112 }, 291 | { "Secret Gold", -1, 160 } 292 | }; 293 | 294 | const std::vector PAINTS_WHEELS 295 | { 296 | { "Default", 156, -1 }, 297 | { "Black", 0, -1 }, 298 | { "Carbon Black", 1, -1 }, 299 | { "Anthracite Black", 11, -1 }, 300 | { "Black Steel", 2, -1 }, 301 | { "Stone Silver", 8, -1 }, 302 | { "Frost White", 122, -1 }, 303 | { "Red", 27, -1 }, 304 | { "Blaze Red", 30, -1 }, 305 | { "Garnet Red", 45, -1 }, 306 | { "Candy Red", 35, -1 }, 307 | { "Sunset Red", 33, -1 }, 308 | { "Salmon Pink", 136, -1 }, 309 | { "Hot Pink", 135, -1 }, 310 | { "Sunrise Orange", 36, -1 }, 311 | { "Orange", 41, -1 }, 312 | { "Bright Orange", 138, -1 }, 313 | { "Gold", 37, -1 }, 314 | { "Straw Brown", 99, -1 }, 315 | { "Dark Copper", 90, -1 }, 316 | { "Dark Ivory", 95, -1 }, 317 | { "Dark Brown", 115, -1 }, 318 | { "Bronze", 109, -1 }, 319 | { "Dark Earth", 153, -1 }, 320 | { "Desert Tan", 154, -1 }, 321 | { "Yellow", 88, -1 }, 322 | { "Race Yellow", 89, -1 }, 323 | { "Yellow Bird", 91, -1 }, 324 | { "Lime Green", 55, -1 }, 325 | { "Pea Green", 125, -1 }, 326 | { "Green", 53, -1 }, 327 | { "Dark Green", 56, -1 }, 328 | { "Olive Green", 151, -1 }, 329 | { "Midnight Blue", 82, -1 }, 330 | { "Royal Blue", 64, -1 }, 331 | { "Baby Blue", 87, -1 }, 332 | { "Bright Blue", 70, -1 }, 333 | { "Flourescent Blue", 140, -1 }, 334 | { "Slate Blue", 81, -1 }, 335 | { "Schafter Purple", 145, -1 }, 336 | { "Midnight Purple", 142, -1 } 337 | }; 338 | 339 | const PaintColour CHROME_COLOUR = 340 | { 341 | "Chrome", 120, 0 342 | }; 343 | 344 | 345 | void onhighlight_livery(MenuItem choice) 346 | { 347 | // common variables 348 | BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()); 349 | 350 | if (!bPlayerExists) 351 | { 352 | return; 353 | } 354 | 355 | Player player = PLAYER::PLAYER_ID(); 356 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 357 | 358 | if (!PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) 359 | { 360 | set_status_text("Player isn't in a vehicle"); 361 | return; 362 | } 363 | 364 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 365 | VEHICLE::SET_VEHICLE_LIVERY(veh, choice.value); 366 | } 367 | 368 | bool onconfirm_livery(MenuItem choice) 369 | { 370 | return true; 371 | } 372 | 373 | bool process_paint_menu_liveries() 374 | { 375 | // common variables 376 | BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()); 377 | 378 | if (!bPlayerExists) 379 | { 380 | return false; 381 | } 382 | 383 | Player player = PLAYER::PLAYER_ID(); 384 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 385 | 386 | if (!PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) 387 | { 388 | set_status_text("Player isn't in a vehicle"); 389 | return false; 390 | } 391 | 392 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 393 | 394 | int count = VEHICLE::GET_VEHICLE_LIVERY_COUNT(veh); 395 | if (count <= 1) 396 | { 397 | set_status_text("No liveries for this vehicle"); 398 | } 399 | 400 | MenuItemVector menuItems; 401 | 402 | for (int i = 0; i < count; i++) 403 | { 404 | std::string modItemNameStr; 405 | 406 | char* modItemNameChr = VEHICLE::GET_LIVERY_NAME(veh, i); 407 | if (modItemNameChr == NULL) 408 | { 409 | std::ostringstream ss; 410 | ss << "Livery #" << (i + 1); 411 | modItemNameStr = ss.str(); 412 | } 413 | else 414 | { 415 | modItemNameStr = std::string(modItemNameChr); 416 | } 417 | 418 | MenuItem item; 419 | item.caption = modItemNameStr; 420 | item.value = i; 421 | item.isLeaf = false; 422 | menuItems.push_back(item); 423 | } 424 | 425 | int currentSelection = VEHICLE::GET_VEHICLE_LIVERY(veh); 426 | return draw_generic_menu(menuItems, ¤tSelection, "Liveries", onconfirm_livery, onhighlight_livery, NULL, vehicle_menu_interrupt); 427 | } 428 | 429 | bool onconfirm_paint_menu(MenuItem choice) 430 | { 431 | ::whichpart = choice.value; 432 | if (whichpart == 4) //Wheels 433 | { 434 | process_paint_menu_special(); 435 | } 436 | else if (whichpart == 3) //Pearl topcoat 437 | { 438 | process_paint_menu_special(); 439 | } 440 | else if (whichpart == -1) 441 | { 442 | process_paint_menu_liveries(); 443 | } 444 | else 445 | { 446 | process_paint_menu_type(); //Primary and Secondary Colors 447 | } 448 | return false; 449 | } 450 | 451 | bool process_paint_menu_special() 452 | { 453 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 454 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 455 | MenuItemVector menuItems; 456 | 457 | int primary, secondary, pearl, wheel; 458 | VEHICLE::GET_VEHICLE_COLOURS(veh, &primary, &secondary); 459 | VEHICLE::GET_VEHICLE_EXTRA_COLOURS(veh, &pearl, &wheel); 460 | 461 | int index = 0; 462 | 463 | /* 464 | if (whichpart == 4) 465 | { 466 | int curWheel = VEHICLE::GET_VEHICLE_MOD(veh, 23); 467 | if (curWheel == -1) 468 | { 469 | set_status_text("You can't repaint the car's default wheels"); 470 | return false; 471 | } 472 | } 473 | */ 474 | 475 | std::vector paints; 476 | int matchIndex = 0; 477 | switch (whichpart) 478 | { 479 | case 3: 480 | whichtype = 4; 481 | paints = PAINTS_PEARL; 482 | for (int i = 0; i < paints.size(); i++) 483 | { 484 | if (pearl == paints[i].pearlAddition) 485 | { 486 | matchIndex = i; 487 | break; 488 | } 489 | } 490 | break; 491 | case 4: 492 | whichtype = 5; 493 | paints = PAINTS_WHEELS; 494 | for (int i = 0; i < paints.size(); i++) 495 | { 496 | if (wheel == paints[i].mainValue) 497 | { 498 | matchIndex = i; 499 | break; 500 | } 501 | } 502 | break; 503 | default: 504 | return false; 505 | } 506 | 507 | for (int i = 0; i < paints.size(); i++) 508 | { 509 | MenuItem item; 510 | item.caption = paints[i].name; 511 | item.value = i; 512 | menuItems.push_back(item); 513 | } 514 | 515 | return draw_generic_menu(menuItems, &matchIndex, "Paint Colors", onconfirm_color_menu_selection, onhighlight_color_menu_selection, NULL); 516 | } 517 | bool process_paint_menu() 518 | { 519 | // common variables 520 | BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()); 521 | 522 | if (!bPlayerExists) 523 | { 524 | return false; 525 | } 526 | 527 | Player player = PLAYER::PLAYER_ID(); 528 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 529 | 530 | if (!PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) 531 | { 532 | set_status_text("Player isn't in a vehicle"); 533 | return false; 534 | } 535 | 536 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 537 | int liveryCount = VEHICLE::GET_VEHICLE_LIVERY_COUNT(veh); 538 | 539 | MenuItemVector menuItems; 540 | 541 | for (int i = 0; i < MENU_PAINT_WHAT.size(); i++) 542 | { 543 | MenuItem item; 544 | item.caption = MENU_PAINT_WHAT[i]; 545 | item.value = i; 546 | item.isLeaf = false; 547 | menuItems.push_back(item); 548 | } 549 | 550 | if (liveryCount > 1) 551 | { 552 | std::ostringstream ss; 553 | ss << "Liveries (" << liveryCount << ")"; 554 | MenuItem item; 555 | item.caption = ss.str(); 556 | item.value = -1; 557 | item.isLeaf = false; 558 | menuItems.push_back(item); 559 | } 560 | 561 | 562 | 563 | return draw_generic_menu(menuItems, 0, "Paint Options", onconfirm_paint_menu, NULL, NULL, vehicle_menu_interrupt); 564 | } 565 | 566 | bool onconfirm_paint_menu_type(MenuItem choice) 567 | { 568 | if (choice.value == 4) 569 | { 570 | //deal with chrome immediately 571 | apply_paint(CHROME_COLOUR); 572 | return false; 573 | } 574 | 575 | std::string category = choice.caption; 576 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 577 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 578 | 579 | int primary, secondary, pearl, wheel; 580 | VEHICLE::GET_VEHICLE_COLOURS(veh, &primary, &secondary); 581 | VEHICLE::GET_VEHICLE_EXTRA_COLOURS(veh, &pearl, &wheel); 582 | 583 | 584 | 585 | std::vector paints; 586 | switch (choice.value) 587 | { 588 | case 0: 589 | paints = PAINTS_NORMAL; 590 | break; 591 | case 1: 592 | paints = PAINTS_METALLIC; 593 | break; 594 | case 2: 595 | paints = PAINTS_MATTE; 596 | break; 597 | case 3: 598 | paints = PAINTS_METAL; 599 | break; 600 | case 4: 601 | paints = PAINTS_PEARL; 602 | break; 603 | case 5: 604 | paints = PAINTS_WHEELS; 605 | break; 606 | default: 607 | return false; 608 | } 609 | 610 | MenuItemVector menuItems; 611 | for (int i = 0; i < paints.size(); i++) 612 | { 613 | MenuItem item; 614 | item.caption = paints[i].name; 615 | item.value = i; 616 | menuItems.push_back(item); 617 | } 618 | 619 | ::whichtype = choice.value; //save paint type for later 620 | 621 | int matchIndex = 0; 622 | 623 | if (::whichpart == 0 || ::whichpart == 2) //index as primary color 624 | { 625 | for (int i = 0; i < paints.size(); i++) 626 | { 627 | if (primary == paints[i].mainValue) 628 | { 629 | matchIndex = i; 630 | break; 631 | } 632 | } 633 | } 634 | else if (::whichpart == 1) //index as secondary color 635 | { 636 | for (int i = 0; i < paints.size(); i++) 637 | { 638 | if (secondary == paints[i].mainValue) 639 | { 640 | matchIndex = i; 641 | break; 642 | } 643 | } 644 | } 645 | 646 | draw_generic_menu(menuItems, &matchIndex, category, onconfirm_color_menu_selection, onhighlight_color_menu_selection, NULL, vehicle_menu_interrupt); 647 | return false; 648 | } 649 | 650 | bool process_paint_menu_type() 651 | { 652 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 653 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 654 | int index = 0; 655 | 656 | MenuItemVector menuItems; 657 | for (int i = 0; i < MENU_PAINT_TYPE.size(); i++) 658 | { 659 | MenuItem item; 660 | item.caption = MENU_PAINT_TYPE[i]; 661 | item.value = i; 662 | item.isLeaf = false; 663 | menuItems.push_back(item); 664 | } 665 | 666 | if (::whichpart == 0) //index as primary color type 667 | { 668 | int paint1, paint2, paint3; 669 | VEHICLE::GET_VEHICLE_MOD_COLOR_1(veh, &paint1, &paint2, &paint3); 670 | index = paint1; 671 | if (index == 3) { index = 0; } //if paint type is pearlescent index to paint type metallic 672 | else if (index > 3) { index = index - 1; } 673 | } 674 | else if (::whichpart == 1) //index as secondary color type 675 | { 676 | int paint1, paint2; 677 | VEHICLE::GET_VEHICLE_MOD_COLOR_2(veh, &paint1, &paint2); 678 | index = paint1; 679 | if (index > 1) { index = index - 1; } 680 | } 681 | 682 | return draw_generic_menu(menuItems, &index, "Paint Type Options", onconfirm_paint_menu_type, NULL, NULL, vehicle_menu_interrupt); 683 | } 684 | 685 | void onhighlight_color_menu_selection(MenuItem choice) 686 | { 687 | onconfirm_color_menu_selection(choice); 688 | } 689 | 690 | bool onconfirm_color_menu_selection(MenuItem choice) 691 | { 692 | std::vector paints; 693 | switch (whichtype) 694 | { 695 | case 0: 696 | paints = PAINTS_NORMAL; 697 | break; 698 | case 1: 699 | paints = PAINTS_METALLIC; 700 | break; 701 | case 2: 702 | paints = PAINTS_MATTE; 703 | break; 704 | case 3: 705 | paints = PAINTS_METAL; 706 | break; 707 | case 4: 708 | paints = PAINTS_PEARL; 709 | break; 710 | case 5: 711 | paints = PAINTS_WHEELS; 712 | break; 713 | default: 714 | return false; 715 | } 716 | 717 | PaintColour whichpaint = (choice.value == -1) ? CHROME_COLOUR : paints[choice.value]; 718 | apply_paint(whichpaint); 719 | return true; 720 | } 721 | 722 | void apply_paint(PaintColour whichpaint) 723 | { 724 | BOOL bPlayerExists = ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()); 725 | Player player = PLAYER::PLAYER_ID(); 726 | Ped playerPed = PLAYER::PLAYER_PED_ID(); 727 | 728 | if (bPlayerExists) 729 | { 730 | if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) 731 | { 732 | Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed); 733 | VEHICLE::SET_VEHICLE_MOD_KIT(veh, 0); 734 | 735 | int primary, secondary; 736 | VEHICLE::GET_VEHICLE_COLOURS(veh, &primary, &secondary); 737 | 738 | if (::whichpart == 0 || ::whichpart == 2) //Apply primary Color 739 | { 740 | VEHICLE::SET_VEHICLE_MOD_COLOR_1(veh, 0, 0, 0); 741 | VEHICLE::SET_VEHICLE_COLOURS(veh, whichpaint.mainValue, secondary); 742 | if (whichpart == 2) 743 | { 744 | primary = whichpaint.mainValue; 745 | } 746 | } 747 | 748 | if (::whichpart == 1 || ::whichpart == 2) //apply secondary Color 749 | { 750 | VEHICLE::SET_VEHICLE_MOD_COLOR_2(veh, 0, 0); 751 | VEHICLE::SET_VEHICLE_COLOURS(veh, primary, whichpaint.mainValue); 752 | 753 | if (whichpart == 2) 754 | { 755 | secondary = whichpaint.mainValue; 756 | } 757 | } 758 | 759 | if (::whichpart == 3) //Apply pearl Topcoat 760 | { 761 | int paint1, paint2, paint3; 762 | VEHICLE::GET_VEHICLE_MOD_COLOR_1(veh, &paint1, &paint2, &paint3); 763 | VEHICLE::SET_VEHICLE_MOD_COLOR_1(veh, 0, primary + 1, primary + 1); 764 | VEHICLE::SET_VEHICLE_COLOURS(veh, primary, secondary); 765 | } 766 | 767 | if (whichpaint.pearlAddition != -1) 768 | { 769 | int useless, wheelCol;//pearl topcoat, wheel color 770 | VEHICLE::GET_VEHICLE_EXTRA_COLOURS(veh, &useless, &wheelCol); 771 | VEHICLE::SET_VEHICLE_EXTRA_COLOURS(veh, whichpaint.pearlAddition, wheelCol); //apply pearl color without changing wheels 772 | } 773 | 774 | if (::whichpart == 4) //Apply wheel color 775 | { 776 | int paint1, paint2;//pearl topcoat, wheel color 777 | VEHICLE::GET_VEHICLE_EXTRA_COLOURS(veh, &paint1, &paint2); 778 | VEHICLE::SET_VEHICLE_EXTRA_COLOURS(veh, paint1, whichpaint.mainValue); //apply wheel color without changing pearl topcoat 779 | } 780 | } 781 | else 782 | { 783 | set_status_text("Player isn't in a vehicle"); 784 | } 785 | } 786 | return; 787 | } --------------------------------------------------------------------------------