openmultiplayer / server-beta-old

open.mp server beta releases
143 stars 14 forks source link

[BUG]: PutPlayerInVehicle failing #133

Closed RodrigoMSR closed 2 years ago

RodrigoMSR commented 2 years ago

Description

It seems that PutPlayerInVehicle is failing much more than in beta 5 and SA-MP.

Demo video: https://youtu.be/ttV36R9C8SE My ping: ~150ms

How to re-produce this bug

  1. Set player to a new virtual world
  2. Create vehicle in that world
  3. Use PutPlayerInVehicle

Maybe object loading has some effect on this, but I can't say.

open.mp server version

open.mp server public beta build 6

Operating system or distribution

Windows 10 and Debian 10

Contact information

Rodrigo#7685

RodrigoMSR commented 2 years ago

I noticed that the vehicle is being streamed-out at times where PutPlayerInVehicle "fails".

Image (see chat): https://i.imgur.com/cxjoqLk.png

ksenonadv commented 2 years ago

The vehicle is streamed out because the server receives updates from previous position due to high ping. There's nothing we can do.

RodrigoMSR commented 2 years ago

Example script (requested by Amir):

#include <a_samp>
#include <zcmd>

main()
{
}

public OnGameModeInit()
{
    SetGameModeText("Bare Script");
    ShowPlayerMarkers(1);
    ShowNameTags(1);

    AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, 0);

    SetPlayerSkin(playerid, 230);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

CMD:car(playerid)
{
    SendClientMessage(playerid, -1, "Executing...");

    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);

    new vehicleid = CreateVehicle(411, 1141.4239, 1355.7878, 10.8203, 180.6853, -1, -1, 100);

    SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));

    //simulates dynamic object loading - add a delay for PutPlayerInVehicle to arrive on the client
    //P.S: delay only works the first time, you need to restart the game
    for(new i = 0; i < 1400; i++)
    {
        new objectid = CreatePlayerObject(playerid, 980, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
        DestroyPlayerObject(playerid, objectid);
    }

    PutPlayerInVehicle(playerid, vehicleid, 0);

    SendClientMessage(playerid, 0x00FF00FF, "Executed");
    return 1;
}

Just use the /car command