Fixed commands not working in single player. (#2980)
* Fixed commands not working in single player. * Code review changes.
This commit is contained in:
parent
9b10969978
commit
79083e34f0
@ -32,11 +32,11 @@ namespace big
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto spawn_location =
|
auto id = ctx->get_sender()->id();
|
||||||
vehicle::get_spawn_location(ctx->get_sender()->id() == self::id ? g.spawn_vehicle.spawn_inside : false,
|
|
||||||
hash,
|
const auto spawn_location = vehicle::get_spawn_location(id == self::id ? g.spawn_vehicle.spawn_inside : false,
|
||||||
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->id()));
|
hash, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(id));
|
||||||
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(ctx->get_sender()->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);
|
auto veh = vehicle::spawn(hash, spawn_location, spawn_heading);
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace big
|
|||||||
{
|
{
|
||||||
if (g.window.gui.format_money)
|
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;
|
Hash casino_chips = self::char_index ? "MP1_CASINO_CHIPS"_J : "MP0_CASINO_CHIPS"_J;
|
||||||
int player_chips;
|
int player_chips;
|
||||||
|
|
||||||
|
@ -127,7 +127,10 @@ namespace big
|
|||||||
|
|
||||||
uint8_t player::id() const
|
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
|
bool player::is_host() const
|
||||||
|
@ -152,13 +152,16 @@ namespace big::vehicle
|
|||||||
|
|
||||||
Vehicle spawn(Hash hash, Vector3 location, float heading, bool is_networked, bool script_veh)
|
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))
|
if (entity::request_model(hash))
|
||||||
{
|
{
|
||||||
auto veh = VEHICLE::CREATE_VEHICLE(hash, location.x, location.y, location.z, heading, is_networked, script_veh, false);
|
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);
|
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);
|
set_mp_bitset(veh);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user