From a83e8f246670149c1ad3b18f0694720ffb05f04c Mon Sep 17 00:00:00 2001 From: Yimura Date: Fri, 15 Oct 2021 11:30:37 +0200 Subject: [PATCH] feat(Util/Toxic): Added blame explode and bounty helpers --- BigBaseV2/src/util/toxic.hpp | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 BigBaseV2/src/util/toxic.hpp diff --git a/BigBaseV2/src/util/toxic.hpp b/BigBaseV2/src/util/toxic.hpp new file mode 100644 index 00000000..0df5a236 --- /dev/null +++ b/BigBaseV2/src/util/toxic.hpp @@ -0,0 +1,53 @@ +#pragma once +#include "core/enums.hpp" +#include "natives.hpp" +#include "script_global.hpp" +#include "system.hpp" + +namespace big::toxic +{ + inline void blame_explode_coord(Player to_blame, Vector3 pos, eExplosionType explosion_type, float damage, bool is_audible, bool is_invisible, float camera_shake) + { + system::patch_blame(true); + FIRE::ADD_OWNED_EXPLOSION( + PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(to_blame), + pos.x, pos.y, pos.z, + (int)explosion_type, + damage, + is_audible, + is_invisible, + camera_shake + ); + system::patch_blame(false); + } + + inline void blame_explode_player(Player to_blame, Player target, eExplosionType explosion_type, float damage, bool is_audible, bool is_invisible, float camera_shake) + { + Vector3 coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(target), true); + blame_explode_coord(to_blame, coords, explosion_type, damage, is_audible, is_invisible, camera_shake); + } + + // param 0 == should send + // param 1 == player target + // param 2 == amount + // param 3 == unk? => always 1 + // param 4 == if some kind of bit must be set + inline void bounty_player(Player target, Player origin, int amount) + { + const size_t arg_count = 22; + int64_t args[22] = { + 2388821078, // 0 + origin, // 1 Player in script self + target, // 2 Player in script self + 0, // 3 unk + amount, // 4 + 0, // 5 => never set + 1, // 6 => always 1 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + *script_global(1658176 + 9).as(), + *script_global(1658176 + 10).as() + }; + + g_pointers->m_trigger_script_event(1, args, arg_count, 1 << origin); + } +} \ No newline at end of file