altv-issues
altv-issues copied to clipboard
setIntoVehicle Broken (C# + JS)
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
it only happens when you are close to 0 point or?
It can happen everywhere
^ 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
^ 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.
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
)
})
Why did you close it ? Its still an issue happening
@yannbcf missclicked idk how that happened lol