refactor(TabSpawn): Changed spawn code to spawn function

This commit is contained in:
Yimura 2021-01-14 21:59:44 +01:00
parent 4259fabe28
commit c76c4b17e9
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682

View File

@ -16,44 +16,10 @@ namespace big
{ {
QUEUE_JOB_BEGIN_CLAUSE(= ) QUEUE_JOB_BEGIN_CLAUSE(= )
{ {
Hash hash = MISC::GET_HASH_KEY((const char*)model); Ped player = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId);
Vector3 location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player, .0, 8.0, .5);
if (hash) features::functions::spawn_vehicle((const char*)model, location, ENTITY::GET_ENTITY_HEADING(player) + 90.f);
{
for (uint8_t i = 0; !STREAMING::HAS_MODEL_LOADED(hash) && i < 100; i++)
{
STREAMING::REQUEST_MODEL(hash);
script::get_current()->yield();
}
if (!STREAMING::HAS_MODEL_LOADED(hash))
{
features::notify::above_map("~r~Failed to spawn model, did you give an incorrect model?");
return;
}
Ped player = PLAYER::PLAYER_PED_ID();
Vector3 location = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player, .0, 8.0, .5);
*(unsigned short*)g_pointers->m_model_spawn_bypass = 0x9090;
Vehicle veh = VEHICLE::CREATE_VEHICLE(hash, location.x, location.y, location.z, ENTITY::GET_ENTITY_HEADING(PLAYER::PLAYER_PED_ID()) + 90.f, true, false, false);
*(unsigned short*)g_pointers->m_model_spawn_bypass = 0x0574;
script::get_current()->yield();
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
if (*g_pointers->m_is_session_started)
{
DECORATOR::DECOR_SET_INT(veh, "MPBitset", 0);
ENTITY::_SET_ENTITY_SOMETHING(veh, true);
int networkId = NETWORK::VEH_TO_NET(veh);
if (NETWORK::NETWORK_GET_ENTITY_IS_NETWORKED(veh))
NETWORK::SET_NETWORK_ID_EXISTS_ON_ALL_MACHINES(networkId, true);
VEHICLE::SET_VEHICLE_IS_STOLEN(veh, false);
}
}
}QUEUE_JOB_END_CLAUSE }QUEUE_JOB_END_CLAUSE
} }