altv-issues icon indicating copy to clipboard operation
altv-issues copied to clipboard

setIntoVehicle Broken (C# + JS)

Open juztim opened this issue 3 years ago • 7 comments

Description of the problem

When using player.setIntoVehicle a weird bug sometimes occures -> https://youtu.be/JsP-yVlKAVk as you can see in the video, the player gets teleported into the vehicle but doesn't get control over the vehicle (also tested with planes). It seems to always happen when the player is in the air, and sometimes when the player is on the ground too (rarely).

EDIT: sometimes you can control the wheels as in the video, sometimes you can't

Reproduction steps

Use setIntoVehicle function on a player that is in the air

Expected behaviour

Player should get control of the vehicle

Additional context

No response

Operating system

Windows 10 + Ubuntu 20.04

Version

Release 6.4 + Dev 7.0-Dev9

juztim avatar Oct 19 '21 16:10 juztim

it only happens when you are close to 0 point or?

FabianTerhorst avatar Oct 20 '21 13:10 FabianTerhorst

It can happen everywhere

C0kkie avatar Oct 20 '21 14:10 C0kkie

^ small addition @FabianTerhorst, the warning "Cannot set player into vehicle, vehicle doesn't exists! Waiting for creation." also is visible when not using debug mode

juztim avatar Oct 20 '21 20:10 juztim

^ small addition @FabianTerhorst, the warning "Cannot set player into vehicle, vehicle doesn't exists! Waiting for creation." also is visible when not using debug mode

that warning is gone for none debug mode in next release.

FabianTerhorst avatar Oct 31 '21 22:10 FabianTerhorst

As an alternative you can use this:

serverside:

player.emit("setIntoVehicle", vehicle, 1) // set player into driver seat

clientside:

alt.onServer("setIntoVehicle", async (vehicle, seat) => {
  if (!vehicle) return

  if (!vehicle.isSpawned) {
    alt.log("[setIntoVehicle] vehicle is not spawned, waiting...")
    await alt.Utils.waitFor(() => vehicle.isSpawned, 5000)
  }

  native.setPedIntoVehicle(
    alt.Player.local,
    vehicle,
    seat - 2, // altv and game natives seat offset
  )
})

xxshady avatar May 23 '22 20:05 xxshady

Why did you close it ? Its still an issue happening

yannbcf avatar Apr 18 '23 23:04 yannbcf

@yannbcf missclicked idk how that happened lol

juztim avatar Apr 18 '23 23:04 juztim