Check if vehicle is near the bot - IsVehicleStreamedIn works properly?
#1

The train server may be used by a BOT and also by players.
For this, use a function that checks if there is someone on the train before it put the BOT:

pawn Код:
if (GetDriverOfTrain () == INVALID_PLAYER_ID)
The FIRST problem: The function works correctly if the player and the train are close to the BOT otherwise the function does not work and the BOT is placed on the train anyway

Then I added the function IsVehicleStreamedIn(TrainID) The BOT only enter in the train if is near
pawn Код:
if(GetDriverOfTrain()==INVALID_PLAYER_ID && IsVehicleStreamedIn(TrainID))
The SECOND problem: And right now there is no one on the train, the BOT does not enter...


This function is working properly?
Or I did something wrong?


pawn Код:
NextPlayback()
{
    if(gPlaybackFileCycle==0)
    {
     StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"StationToTrain");
     gPlaybackFileCycle=1;
    }
    else if(gPlaybackFileCycle==1)
    {
      if(GetDriverOfTrain()==INVALID_PLAYER_ID && IsVehicleStreamedIn(TrainID))
      {
        SendCommand("/train"); //put NPC on train
        StartRecordingPlayback(PLAYER_RECORDING_TYPE_DRIVER,"TourLSLVSF");
        gPlaybackFileCycle=2;
      }
      else
      {
        StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"WaitingForTrain");
        gPlaybackFileCycle=3;
      }
    }
    else if(gPlaybackFileCycle==2)
    {
        StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"WaitingForTrain");
        gPlaybackFileCycle=3;
    }
    else if(gPlaybackFileCycle==3)
    {
      SetTimer("TimeWaiting",30000,0);
    }
}

public TimeWaiting()
{
    StartRecordingPlayback(PLAYER_RECORDING_TYPE_ONFOOT,"WaitingToTrain");
    gPlaybackFileCycle=1;
}

public OnRecordingPlaybackEnd()
{
  NextPlayback();
}
I hope you understand me
Thanks and sorry bad english
Reply
#2

I also had problems with this function when used for BOTS
But I dont know if there is a confirmed bug...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)