Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(extra-natives/five): SetDeployOutriggers native #2941

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions code/components/extra-natives-five/src/VehicleExtraNatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,19 @@ static HookFunction initFunction([]()
}
});

using CVehicle_SetDeployOutriggers_t = void(__fastcall*)(fwEntity* vehicle, bool deploy);
void* deployOutriggersFunctionAddress = hook::get_pattern("48 83 EC ? 38 91 ? ? ? ? 74 ? 88 91 ? ? ? ? 48 8B 89");
const auto CVehicle_SetDeployOutriggers = reinterpret_cast<CVehicle_SetDeployOutriggers_t>(deployOutriggersFunctionAddress);

fx::ScriptEngine::RegisterNativeHandler("SET_DEPLOY_OUTRIGGERS", [=](fx::ScriptContext& context)
{
if (fwEntity* vehicle = getAndCheckVehicle(context, "SET_DEPLOY_OUTRIGGERS"))
{
const auto deploy = context.GetArgument<bool>(1);
CVehicle_SetDeployOutriggers(vehicle, deploy);
}
});

MH_Initialize();
MH_CreateHook(hook::get_pattern("E8 ? ? ? ? 8A 83 DA 00 00 00 24 0F 3C 02", -0x32), DeleteVehicleWrap, (void**)&g_origDeleteVehicle);
MH_CreateHook(hook::get_pattern("80 7A 4B 00 45 8A F9", -0x1D), DeleteNetworkCloneWrap, (void**)&g_origDeleteNetworkClone);
Expand Down
16 changes: 16 additions & 0 deletions ext/native-decls/SetDeployOutriggers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
ns: CFX
apiset: client
game: gta5
---
## SET_DEPLOY_OUTRIGGERS

```c
void SET_DEPLOY_OUTRIGGERS(Vehicle vehicle, bool deploy);
```

Sets whether the outriggers of a vehicle are deployed or retracted.

## Parameters
* **vehicle**: The target vehicle.
* **deploy**: Whether to deploy or retract the outriggers.
Loading