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

tweak(extra-natives/five): implement [GET/SET]_VEHICLE_XMAS_SNOW_FACTOR #3000

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

ook3D
Copy link
Contributor

@ook3D ook3D commented Dec 14, 2024

Goal of this PR

add natives to allow for control over the effect xmas weather has on vehicle handling.
...

How is this PR achieving the goal

by adding 2 new natives for getting and setting the value responsible for effecting this.
...

This PR applies to the following area(s)

FiveM, ScRT: Lua, ScRT: C#, ScRT: JS
...

Successfully tested on

Game builds: ..

Platforms: Windows, Linux

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

@github-actions github-actions bot added ScRT: C# Issues/PRs related to either C# scripting runtimes ScRT: JS Issues/PRs related to the JavaScript scripting runtime ScRT: Lua Issues/PRs related to the Lua scripting runtime triage Needs a preliminary assessment to determine the urgency and required action labels Dec 14, 2024
@ook3D
Copy link
Contributor Author

ook3D commented Dec 14, 2024

		constexpr float ForceFactor = 1.0f;
		hook::put<uint32_t>(hook::get_pattern("F3 0F 59 05 ? ? ? ? 48 23 C8"), ForceFactor);

i used this code successfully in singleplayer, so im not sure if my implementation in fivem will behave differently without the hook::put

i should also mention in singleplayer i was using a slightly modified hook::put function,

	template<typename ValueType, typename AddressType>
	inline void put(AddressType address, ValueType value)
	{
		DWORD oldProtect;
		VirtualProtect((void*)address, sizeof(value), PAGE_EXECUTE_READWRITE, &oldProtect);

		std::memcpy((void*)address, &value, sizeof(value));

		VirtualProtect((void*)address, sizeof(value), oldProtect, &oldProtect);

		FlushInstructionCache(GetCurrentProcess(), (void*)address, sizeof(value));
	}

@github-actions github-actions bot added invalid Requires changes before it's considered valid and can be (re)triaged and removed triage Needs a preliminary assessment to determine the urgency and required action labels Dec 14, 2024
@github-actions github-actions bot added triage Needs a preliminary assessment to determine the urgency and required action and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Dec 14, 2024
@prikolium-cfx
Copy link
Collaborator

Thanks for your contribution

@prikolium-cfx prikolium-cfx added ready-to-merge This PR is enqueued for merging and removed triage Needs a preliminary assessment to determine the urgency and required action labels Jan 9, 2025
@prikolium-cfx prikolium-cfx merged commit 81648b0 into citizenfx:master Jan 9, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR is enqueued for merging ScRT: C# Issues/PRs related to either C# scripting runtimes ScRT: JS Issues/PRs related to the JavaScript scripting runtime ScRT: Lua Issues/PRs related to the Lua scripting runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants