20.10.2009, 22:08
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:
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
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?
I hope you understand me
Thanks and sorry bad english
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)
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))
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();
}
Thanks and sorry bad english