feat(Global): Added pointer to local player ped

This commit is contained in:
Yimura 2021-07-25 22:24:22 +02:00
parent 44fd2ee600
commit 814cce7d55
5 changed files with 20 additions and 3 deletions

View File

@ -12,6 +12,8 @@ namespace big
{
looped::system_screen_size();
looped::system_update_players();
looped::system_update_pointers();
}QUEUE_JOB_END_CLAUSE
QUEUE_JOB_BEGIN_CLAUSE()

View File

@ -16,6 +16,7 @@ namespace big
static void self_no_ragdoll();
static void system_update_players();
static void system_update_pointers();
static void system_screen_size();
static void weapons_cage_gun();

View File

@ -0,0 +1,11 @@
#include "backend/looped/looped.hpp"
#include "gta_util.hpp"
namespace big
{
void looped::system_update_pointers()
{
if (g_local_player == nullptr)
g_local_player = gta_util::get_local_ped();
}
}

View File

@ -51,8 +51,9 @@
#include "logger.hpp"
#include "core/globals.hpp"
#include "core/class/CPed.hpp"
#include "gta/player.hpp"
// #include "settings.h"
namespace big
{
@ -65,4 +66,6 @@ namespace big
inline HANDLE g_main_thread{};
inline DWORD g_main_thread_id{};
inline std::atomic_bool g_running{ true };
inline CPed* g_local_player;
}

View File

@ -1,7 +1,7 @@
#pragma once
#include "common.hpp"
#include "gta/array.hpp"
#include "gta/ped_factory.hpp"
#include "core/class/CPedFactory.hpp"
#include "gta/player.hpp"
#include "gta/script_thread.hpp"
#include "gta/tls_context.hpp"
@ -25,7 +25,7 @@ namespace big::gta_util
{
if (auto ped = ped_factory->m_local_ped)
{
return ped->m_playerinfo;
return ped->m_player_info;
}
}