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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -127,7 +127,10 @@ namespace big
|
||||
|
||||
uint8_t player::id() const
|
||||
{
|
||||
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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user