feat: remote taze player (#94)

Co-authored-by: Yimura <andreas.maerten@scarlet.be>
This commit is contained in:
Maddy 2022-03-08 13:56:14 -05:00 committed by GitHub
parent 9503ab4fdb
commit bf43f6f9ce
2 changed files with 20 additions and 4 deletions

View File

@ -44,6 +44,20 @@ namespace big::toxic
g_pointers->m_trigger_script_event(1, args, arg_count, -1);
}
inline void taze_player(const Player player)
{
const Ped target = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player);
constexpr auto max_attempts = 20;
for (size_t attempts = 0; attempts < max_attempts && !ENTITY::IS_ENTITY_DEAD(target, false); attempts++)
{
const Vector3 destination = PED::GET_PED_BONE_COORDS(target, (int)PedBones::SKEL_ROOT, 0.0f, 0.0f, 0.0f);
const Vector3 origin = PED::GET_PED_BONE_COORDS(target, (int)PedBones::SKEL_R_Hand, 0.0f, 0.0f, 0.2f);
MISC::SHOOT_SINGLE_BULLET_BETWEEN_COORDS(origin.x, origin.y, origin.z, destination.x, destination.y, destination.z, 1, 0, RAGE_JOAAT("WEAPON_STUNGUN"), PLAYER::PLAYER_PED_ID(), false, true, 1);
}
}
inline void clear_wanted_player(Player target)
{
@ -56,4 +70,4 @@ namespace big::toxic
g_pointers->m_trigger_script_event(1, args, arg_count, 1 << target);
}
}
}

View File

@ -121,10 +121,12 @@ namespace big
g_player_service->get_selected()->id(),
eExplosionType::PLANE, 1000, false, true, 0.f
);
});
}
});
components::button("Taze", [] {
toxic::taze_player(g_player_service->get_selected()->id());
});
}
}
}
}