You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After applying PutPlayerInVehicle to a player who is currently driving any vehicle, the player will still appear to other players as the driver of the original vehicle after the function executes. Meanwhile, the original vehicle will begin moving as if it were being controlled by the player, alongside the new vehicle.
To Reproduce
Steps to reproduce the behavior:
Spawn a vehicle and get inside it as the driver.
Spawn another vehicle and use the PutPlayerInVehicle function for the driver's seat.
Expected behavior
To synchronize with all players that the player has been teleported to a new vehicle.
// In order to get the front position of the vehicle, use this functionstockVehicle_GetRelativePos(vehicleid, &Float:x, &Float:y, &Float:z, Float:xoff =0.0, Float:yoff =0.0, Float:zoff =0.0)
{
if(!IsValidVehicle(vehicleid))
return INVALID_VEHICLE_ID;
newFloat: angle;
GetVehicleZAngle(vehicleid, angle);
angle =360- angle;
GetVehiclePos(vehicleid, x, y, z);
x =floatsin(angle, degrees) * yoff +floatcos(angle, degrees) * xoff + x;
y =floatcos(angle, degrees) * yoff -floatsin(angle, degrees) * xoff + y;
z = zoff + z;
return1;
}
// Command to test the bug@command() testcommand(playerid, params[], help)
{
newFloat:x,
Float:y,
Float:z,
Float:rotation;
if(IsPlayerInAnyVehicle(playerid))
{
Vehicle_GetRelativePos(GetPlayerVehicleID(playerid), x, y, z, 0.0, 10.00);
GetVehicleZAngle(GetPlayerVehicleID(playerid), rotation);
}
else
{
GetPlayerPos(playerid, x, y, z);
GetPlayerFacingAngle(playerid, rotation);
}
// After getting new coordinates, we will create a vehicle// and if player is already in a vehicle, we will teleport it// from the old car to the new car// From DRIVER state to DRIVER statenew carid =CreateVehicle(411, x, y, z, rotation, -1, -1, -1);
PutPlayerInVehicle(playerid, carid, 0);
// Turn on the engineSetVehicleParamsEx(carid, true, false, false, false, false, false, false);
return1;
}
The text was updated successfully, but these errors were encountered:
It is probably a client issue, I can reproduce the issue on a SA-MP server.
We can also experience it while spectating a player: https://www.youtube.com/watch?v=USeWnlcpbFg
Describe the bug
After applying PutPlayerInVehicle to a player who is currently driving any vehicle, the player will still appear to other players as the driver of the original vehicle after the function executes. Meanwhile, the original vehicle will begin moving as if it were being controlled by the player, alongside the new vehicle.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
To synchronize with all players that the player has been teleported to a new vehicle.
Screenshots and/or logs
https://youtu.be/z_WwqUj2_0I
Release version
open.mp 1.2.0.2670 (W)
Script for testing
The text was updated successfully, but these errors were encountered: