From 35bff8dae995440873da95eea0020f1a6915237c Mon Sep 17 00:00:00 2001 From: Yimura Date: Sun, 3 Jan 2021 22:14:06 +0100 Subject: [PATCH] wip(SuperSprint): Added sky diving to super sprint --- .../src/features/looped/super_sprint.cpp | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/BigBaseV2/src/features/looped/super_sprint.cpp b/BigBaseV2/src/features/looped/super_sprint.cpp index 42cd91a6..3d198766 100644 --- a/BigBaseV2/src/features/looped/super_sprint.cpp +++ b/BigBaseV2/src/features/looped/super_sprint.cpp @@ -3,6 +3,7 @@ namespace big { static bool bLastSuperSprint = false; + static bool bSkyDiving = false; void features::super_sprint() { @@ -12,12 +13,25 @@ namespace big { QUEUE_JOB_BEGIN_CLAUSE(= ) { - if (TASK::IS_PED_SPRINTING(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId))) - { - Ped player = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId); + Ped player = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_playerId); + Vector3 location = ENTITY::GET_ENTITY_COORDS(player, true); + float ground; + MISC::GET_GROUND_Z_FOR_3D_COORD(location.x, location.y, location.z, &ground, 0, 0); + bool flying = location.z - ground > 3; + if (flying && !bSkyDiving) + { + TASK::TASK_SKY_DIVE(player, true); + + bSkyDiving = true; + } + else if (!flying && bSkyDiving) + bSkyDiving = false; + + if (TASK::IS_PED_SPRINTING(player) || flying) + { Vector3 offset = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(player, 0, 0.6, 0); - ENTITY::APPLY_FORCE_TO_ENTITY(player, 1, 0.0f, 1.3, 0, 0.0f, 0.0f, 0.0f, 0, 1, 1, 1, 0, 1); + ENTITY::APPLY_FORCE_TO_ENTITY(player, 1, 0.0f, 1.3, bSkyDiving ? 1.f : 0.f, 0.0f, 0.0f, 0.0f, 0, 1, 1, 1, 0, 1); PLAYER::SET_PLAYER_SPRINT(g_playerId, 1); PLAYER::SET_RUN_SPRINT_MULTIPLIER_FOR_PLAYER(g_playerId, 1.49);