feat(Functions): Added ambient rp and improved take control

This commit is contained in:
Yimura 2021-02-03 16:39:29 +01:00
parent ea69dda047
commit 2f9ff404dc
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78
2 changed files with 20 additions and 0 deletions

View File

@ -137,8 +137,13 @@ namespace big::features::functions
if (NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(ent)) return true;
for (uint8_t i = 0; !NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(ent) && i < 5; i++)
{
bool in_spectator = NETWORK::NETWORK_IS_IN_SPECTATOR_MODE();
if (in_spectator) NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(0, PLAYER::PLAYER_PED_ID());
NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(ent);
if (in_spectator) NETWORK::NETWORK_SET_IN_SPECTATOR_MODE(1, PLAYER::PLAYER_PED_ID());
script::get_current()->yield();
}
if (!NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(ent)) return false;
@ -247,6 +252,20 @@ namespace big::features::functions
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
}
void create_ambient_rp(Vector3 location)
{
// vw_prop_vw_colle_imporage
Hash hash = RAGE_JOAAT("vw_prop_vw_colle_alien");
do {
STREAMING::REQUEST_MODEL(hash);
script::get_current()->yield(1ms);
} while (!STREAMING::HAS_MODEL_LOADED(hash));
OBJECT::CREATE_AMBIENT_PICKUP(0x2C014CA6, location.x, location.y, location.z + 0.5f, 0, 10, hash, false, true);
STREAMING::SET_MODEL_AS_NO_LONGER_NEEDED(hash);
}
void cage_ped(Ped ped)
{
Hash hash = RAGE_JOAAT("prop_gold_cont_01");

View File

@ -18,6 +18,7 @@ namespace big::features::functions
Entity spawn_vehicle(const char* model, Vector3 location, float heading);
void create_ambient_money(Vector3 location, int amount);
void create_ambient_rp(Vector3 location);
void cage_ped(Ped ped);
bool take_control_of_entity(Entity ent);