Fixed commands not working in single player. (#2980)

* Fixed commands not working in single player.

* Code review changes.
This commit is contained in:
gir489 2024-04-27 10:10:35 -04:00 committed by GitHub
parent 3e5f4f5639
commit 51cd6e37ff
4 changed files with 14 additions and 8 deletions

View File

@ -32,11 +32,11 @@ namespace big
return;
}
const auto spawn_location =
vehicle::get_spawn_location(ctx->get_sender()->id() == self::id ? g.spawn_vehicle.spawn_inside : false,
hash,
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
auto id = ctx->get_sender()->id();
const auto spawn_location = vehicle::get_spawn_location(id == self::id ? g.spawn_vehicle.spawn_inside : false,
hash, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(id));
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(id));
auto veh = vehicle::spawn(hash, spawn_location, spawn_heading);

View File

@ -36,7 +36,7 @@ namespace big
{
if (g.window.gui.format_money)
{
auto arg0 = src->get_arg<int>(0);
auto arg0 = src->get_arg<int>(0);
Hash casino_chips = self::char_index ? "MP1_CASINO_CHIPS"_J : "MP0_CASINO_CHIPS"_J;
int player_chips;

View File

@ -127,7 +127,10 @@ namespace big
uint8_t player::id() const
{
return m_net_game_player == nullptr ? -1 : m_net_game_player->m_player_id;
if (*g_pointers->m_gta.m_is_session_started)
return m_net_game_player == nullptr ? -1 : m_net_game_player->m_player_id;
else
return self::id;
}
bool player::is_host() const

View File

@ -152,13 +152,16 @@ namespace big::vehicle
Vehicle spawn(Hash hash, Vector3 location, float heading, bool is_networked, bool script_veh)
{
if (is_networked && !*g_pointers->m_gta.m_is_session_started)
is_networked = false;
if (entity::request_model(hash))
{
auto veh = VEHICLE::CREATE_VEHICLE(hash, location.x, location.y, location.z, heading, is_networked, script_veh, false);
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
if (is_networked && *g_pointers->m_gta.m_is_session_started)
if (is_networked)
{
set_mp_bitset(veh);
}