From 8fc311eaba0bc23a2b4cfbbd7882d2385710e234 Mon Sep 17 00:00:00 2001 From: BDKPlayer Date: Fri, 10 Apr 2020 17:54:48 +0200 Subject: Added Config system to save/load settings --- Engine.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) (limited to 'Engine.cpp') diff --git a/Engine.cpp b/Engine.cpp index 8bb4575..94019c8 100644 --- a/Engine.cpp +++ b/Engine.cpp @@ -128,24 +128,53 @@ ImVec4 Engine::GetPlayerColorImGUI(int colorIndex) const return color; } +Player* Engine::GetPlayer(int index) const +{ + const int totalPlayers = GetTotalPlayers(); + if (index > totalPlayers) + { + return nullptr; + } + + MainScreen* mainScreen = GetMainScreen(); + if (!mainScreen) + { + return nullptr; + } + + World* main = GetWorld(); + if (!main) + { + return nullptr; + } + + PlayerArray* playerArray = main->pPlayerArray; + if (!playerArray) + { + return nullptr; + } + + return playerArray->playerData[index].player; +} + Player* Engine::GetPlayerByName(char* playerName) const { MainScreen* mainScreen = GetMainScreen(); if (!mainScreen) { - return NULL; + return nullptr; } World* main = GetWorld(); if (!main) { - return NULL; + return nullptr; } PlayerArray* playerArray = main->pPlayerArray; if (!playerArray) { - return NULL; + return nullptr; } int totalPlayers = GetTotalPlayers(); @@ -161,7 +190,7 @@ Player* Engine::GetPlayerByName(char* playerName) const return player; } } - return NULL; + return nullptr; } Player* Engine::GetLocalPlayer() const @@ -214,4 +243,13 @@ void Engine::PrintBottomNotification(const char* message, unsigned int hexcolor) typedef void(__fastcall* tPrintBottomText) (GameScreen* AVGameScreen, const char* message, unsigned int hexcolor, int64_t unused); static tPrintBottomText fPrintBottomText = (tPrintBottomText)(base + Offsets::printBottomText); fPrintBottomText(GetMainScreen()->pGameScreen, message, hexcolor, 0xffffffffffffffff); //Color format: RBGA -} \ No newline at end of file +} + +int64_t Engine::Flare(float xPos, float yPos) const +{ + typedef __int64(__fastcall* tCreateFlare) (Player* player, __int64 hundert12, __int64 zero1, __int64 zero2, float xPos, float yPos, int64_t zero3, int64_t zero4); + static tCreateFlare fCreateFlare = (tCreateFlare)(base + 0xc31270); + + return fCreateFlare(GetLocalPlayer(), 0x112, 0, 0, 220.f, 220.f, 0, 0); + //__usercall fhsCreateFlare_MAYBE_7FF718CF1270@( __int64 a3_zero@, __int64 a4_zero@, float xPos@, float yPos@, __int64 a5_zero, int a6_Zero) +} -- cgit v1.2.3