Skip to content

Conversation

@DmitriyColeman
Copy link
Contributor

This PR refines the map teleport functionality by adding the corresponding ACL permission and implementing logic to teleport to the ground instead of a fixed coordinate.
Additionally, the teleport has been moved to the server side to avoid issues with onPlayerTeleport and other server-side anti-cheat mechanisms.

@DmitriyColeman DmitriyColeman requested a review from qaisjp as a code owner January 6, 2026 21:24
Copy link
Contributor

@omar-o22 omar-o22 left a comment

Choose a reason for hiding this comment

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

LGTM.

@DmitriyColeman
Copy link
Contributor Author

Done :)

local px = 6000 * ((x - minX) / msx) - 3000
local py = 3000 - 6000 * ((y - minY) / msy)
setElementPosition(localPlayer, px, py, 10)
enginePreloadWorldArea(px, py, 527, "collisions")
Copy link
Member

Choose a reason for hiding this comment

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

Why 527 specifically, what's special about this value?

Can we add a descriptive variable so we don't have 'magic' numbers in multiple places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

527 is the height of the highest point in GTA:SA - Mount Chiliad.
I don’t see any reason to move this into a separate static variable. It’s very unlikely to ever change.

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference if you preload the area at z 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, I don’t know. I’ll do some testing (more like a comparison) a bit later

Copy link
Contributor

Choose a reason for hiding this comment

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

https://wiki.multitheftauto.com/wiki/EnginePreloadWorldArea
Wiki examples use z 0 and then get ground position, that's why I asked. Testing is a good idea

Copy link
Member

Choose a reason for hiding this comment

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

527 is the height of the highest point in GTA:SA - Mount Chiliad. I don’t see any reason to move this into a separate static variable. It’s very unlikely to ever change.

The concern here is magic numbers, and the fact it's unlikely to change doesn't make this any less of a 'magic' number.
Even if the value is correct and unlikely to change, naming it makes the intent explicit and keeps the code self-documenting.
If I had the question, how many others who read the code in future will have the same question?

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.

4 participants