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(server/state): add GIVE_PED_SCRIPTED_TASK handler #3096

Conversation

william-des
Copy link
Contributor

@william-des william-des commented Jan 25, 2025

Goal of this PR

This PR adds a way to prevent certain manipulations of NPCs. Native functions such as TaskShootAtEntity and TaskGoToEntity are often used by malicious users to manipulate NPC into harming other players without requiring network control over them.

I believe that a handler is more suitable than a convar in this case, considering the wide variety of tasks.

How is this PR achieving the goal

Introduce CGivePedScriptedTaskEvent struct and added the corresponding handler in the GetGameEventHandler and GetGameEventHandlerWithEvent functions.

This PR applies to the following area(s)

FiveM server

Successfully tested on

Game builds: 3095

Platforms: Windows

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 triage Needs a preliminary assessment to determine the urgency and required action 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 Jan 25, 2025
Copy link

@martonp96 martonp96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

@martonp96 martonp96 added ready-to-merge This PR is enqueued for merging and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Jan 27, 2025
@spacevx
Copy link
Contributor

spacevx commented Jan 28, 2025

@william-des maybe you could add documentation like it's done on weaponDamageEvent

@william-des william-des force-pushed the feat/give-ped-scripted-task-handler branch from 9ad4d28 to eeb7cc7 Compare January 29, 2025 09:34
@william-des
Copy link
Contributor Author

@william-des maybe you could add documentation like it's done on weaponDamageEvent

Done. Didn't realize these were used for documentation generation.

@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Jan 29, 2025
@william-des william-des force-pushed the feat/give-ped-scripted-task-handler branch from eeb7cc7 to c20afb9 Compare January 29, 2025 10:09
@prikolium-cfx prikolium-cfx merged commit fa40004 into citizenfx:master Feb 4, 2025
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Requires changes before it's considered valid and can be (re)triaged ready-to-merge This PR is enqueued for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants