Skip to content

fix(commands/tp) Fix teleporting in vehicle#1739

Merged
FBFezz merged 1 commit intoesx-framework:devfrom
Zykem:fix/tp-with-vehicle
Jan 24, 2026
Merged

fix(commands/tp) Fix teleporting in vehicle#1739
FBFezz merged 1 commit intoesx-framework:devfrom
Zykem:fix/tp-with-vehicle

Conversation

@Zykem
Copy link
Copy Markdown
Contributor

@Zykem Zykem commented Oct 20, 2025

Description

This PR fixes an issue where admins using the /tp command while in a vehicle would lose their vehicle. Now, if a player is in a vehicle, the vehicle is teleported along with the player.


Motivation

Admins using the /tp command while inside a vehicle would lose the vehicle because only the player’s coordinates were updated. This fix ensures that the vehicle moves along with the player, preventing accidental loss.


Implementation Details

  • Retrieve the player ped using GetPlayerPed.
  • Check if the player is currently in a vehicle using GetVehiclePedIsIn.
  • If a vehicle exists, use SetEntityCoords to teleport the vehicle, which automatically teleports the player as well.
  • If the player is not in a vehicle, update the player’s coordinates using xPlayer.setCoords.

Usage Example

/tp [x] [y] [z]

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Nov 16, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

@FBFezz FBFezz left a comment

Choose a reason for hiding this comment

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

LGTM

@FBFezz FBFezz merged commit 0e9b8e5 into esx-framework:dev Jan 24, 2026
1 of 3 checks passed
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