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

fix: preventing carjack on scripted entities #160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hakanesnn
Copy link

@hakanesnn hakanesnn commented Dec 24, 2024

Description

The current carjack code prevents killing the driver in bank trucks, carjack works as soon as the gun is pointed, it needs to be blocked in entities generated by any script.

Checklist

  • I have personally loaded this code into an updated Qbox project and checked all of its functionality.
  • My pull request fits the contribution guidelines & code conventions.

@@ -125,13 +125,16 @@ local function watchCarjackingAttempts()
and not IsEntityDead(target)
and not IsPedAPlayer(target)
then
local targetveh = GetVehiclePedIsIn(target, false)
local script = GetEntityScript(target)
Copy link
Member

Choose a reason for hiding this comment

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

Would IsEntityAMissionEntity be better here instead?

Copy link
Author

Choose a reason for hiding this comment

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

IsEntityAMissionEntity may not fully meet the need, the entity may not be set as a mission entity, it may be wanted to be deleted as soon as it leaves the player's area, GetEntityScript made more sense to me.

Copy link
Author

Choose a reason for hiding this comment

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

As a different solution, a model blacklist can also be made for carjack, which also provides a solution.

Copy link
Member

@Manason Manason left a comment

Choose a reason for hiding this comment

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

Has GetEntityScript been tested? Does it return nil/false for world spawn vehicles and returns a value for client and server spawned vehicles via native?

@hakanesnn
Copy link
Author

Has GetEntityScript been tested? Does it return nil/false for world spawn vehicles and returns a value for client and server spawned vehicles via native?

Yes I tested it, for entities spawned with script the name of the script is returned, for others nil is returned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants