-
-
Notifications
You must be signed in to change notification settings - Fork 177
admin2: refine radar teleport functionality #706
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
base: master
Are you sure you want to change the base?
Conversation
omar-o22
left a comment
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.
LGTM.
…e high points on the map
|
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") |
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.
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?
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.
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.
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.
What's the difference if you preload the area at z 0?
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.
Honestly, I don’t know. I’ll do some testing (more like a comparison) a bit later
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.
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
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.
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?
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.