-
Notifications
You must be signed in to change notification settings - Fork 45
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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?
Yes I tested it, for entities spawned with script the name of the script is returned, for others nil is returned. |
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