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 ability to move server-side vehicles that are far away from the player #3391

Merged

Conversation

MegadreamsBE
Copy link
Member

fixes #3389

Adds extra checks to ensure that players cannot use setElementPosition client-side to move vehicles that are far away from them. Essentially closes loopholes that made it possible for players to become the syncer of said vehicles.

Copy link
Contributor

@Nico8340 Nico8340 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 to me 🚀

@Lpsd
Copy link
Member

Lpsd commented May 16, 2024

I think it would be good to make MAX_CONTACT_SYNC_RADIUS value configurable via the Lua API

@MegadreamsBE
Copy link
Member Author

MegadreamsBE commented May 16, 2024

I think it would be good to make MAX_CONTACT_SYNC_RADIUS value configurable via the Lua API

In that case it'd probably be better to link it with the syncer radius and make them configurable together. On its own there's not much of a reason to be able to configure this radius

EDIT: Adds the ability to disable it which is actually pretty useful, I stand corrected and thus implemented it

Copy link
Contributor

@Nico8340 Nico8340 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 🎉

@MegadreamsBE
Copy link
Member Author

I think it would be good to make MAX_CONTACT_SYNC_RADIUS value configurable via the Lua API

Added a configurable server setting for it. You can configure it as follows during runtime:
setServerConfigSetting('vehicle_contact_sync_radius', 30)

Which should satisfy this.

@haron4igg
Copy link

Just to be sure...

If client will set position for vehicle locally - will car appear locally to him?
If so - when player will enter the car - it will be forcely synced to new location anyway?

@MegadreamsBE
Copy link
Member Author

Just to be sure...

If client will set position for vehicle locally - will car appear locally to him? If so - when player will enter the car - it will be forcely synced to new location anyway?

If you're not the syncer, even if the vehicle appears to be near you on your client, you cannot enter it. Instead attempting to the enter the vehicle will reset its position to the position stored on the server. It has always been like this and the PR does not change that.

Copy link
Member

@Lpsd Lpsd left a comment

Choose a reason for hiding this comment

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

LGTM!

@Lpsd
Copy link
Member

Lpsd commented May 23, 2024

@Lpsd Lpsd merged commit e3338c2 into multitheftauto:master May 23, 2024
6 checks passed
MTABot pushed a commit that referenced this pull request May 23, 2024
e3338c2 Fix ability to move server-side vehicles that are far away from the player (#3391)
@TheNormalnij TheNormalnij added this to the 1.6.1 milestone May 25, 2024
@TheNormalnij TheNormalnij added the enhancement New feature or request label May 25, 2024
MegadreamsBE added a commit to MegadreamsBE/mtasa-blue that referenced this pull request Jun 6, 2024
…layer (multitheftauto#3391)

* Fix ability to move server-side vehicles that are far away from the player

* Fix wrongly named radius define

* Add vehicle contact sync radius server setting

* Add vehicle_contact_sync_radius to mtaserver.conf template

* Add dimension checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client-side setElementPosition syncs for server-side vehicles
5 participants