From 2f9ff404dc0903d440d97a6aa64800173482d60b Mon Sep 17 00:00:00 2001 From: Yimura Date: Wed, 3 Feb 2021 16:39:29 +0100 Subject: [PATCH] feat(Functions): Added ambient rp and improved take control --- BigBaseV2/src/features/functions.cpp | 19 +++++++++++++++++++ BigBaseV2/src/features/functions.hpp | 1 + 2 files changed, 20 insertions(+) diff --git a/BigBaseV2/src/features/functions.cpp b/BigBaseV2/src/features/functions.cpp index 0c55449d..f4d25a55 100644 --- a/BigBaseV2/src/features/functions.cpp +++ b/BigBaseV2/src/features/functions.cpp @@ -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"); diff --git a/BigBaseV2/src/features/functions.hpp b/BigBaseV2/src/features/functions.hpp index 1b5f7cb2..106019d4 100644 --- a/BigBaseV2/src/features/functions.hpp +++ b/BigBaseV2/src/features/functions.hpp @@ -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);