Check if vehicle is near the bot - IsVehicleStreamedIn works properly? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Check if vehicle is near the bot - IsVehicleStreamedIn works properly? (
/showthread.php?tid=103702)
Check if vehicle is near the bot - IsVehicleStreamedIn works properly? -
brazzucas - 20.10.2009
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
Re: Check if vehicle is near the bot - IsVehicleStreamedIn works properly? -
Mr.Z - 21.10.2009
I also had problems with this function when used for BOTS
But I dont know if there is a confirmed bug...