05.01.2010, 12:12
Hey,
I got some problems with my bots.. When I start server bots work perfectly.. But after 10-15 minutes all bots leaves their vehicles and just stands on vehicle.. I have no idea what's wrong, so I have this timer to check if bots are not in vehicle:
But when I tried playing in my server, with this code working, bots still stopped working after 10-15 minutes.. And they didn't got back to their vehicle...
Here's an example of one NPC script:
I got some problems with my bots.. When I start server bots work perfectly.. But after 10-15 minutes all bots leaves their vehicles and just stands on vehicle.. I have no idea what's wrong, so I have this timer to check if bots are not in vehicle:
pawn Код:
//OnGameModeInit
SetTimer("CheckNPCs",6000,1);
//
forward CheckNPCs();
public CheckNPCs()
{
new bname[24];
foreach(Bot,i)
{
GetPlayerName(i,bname,sizeof(bname));
if(!IsPlayerInAnyVehicle(i))
{
if(!strcmp(bname,"Jenifer"))
{
PutPlayerInVehicle(i,TrainSF,0);
}
if(!strcmp(bname,"Mike"))
{
PutPlayerInVehicle(i,TrainSF2,0);
}
if(!strcmp(bname,"Dima"))
{
PutPlayerInVehicle(i,TrainSF3,0);
}
if(!strcmp(bname,"Vince"))
{
PutPlayerInVehicle(i,TrainSF4,0);
}
if(!strcmp(bname,"Jonas"))
{
PutPlayerInVehicle(i,BusAP,0);
}
if(!strcmp(bname,"Malcolm"))
{
PutPlayerInVehicle(i,BusAP2,0);
}
if(!strcmp(bname,"Phillip"))
{
PutPlayerInVehicle(i,BusAP3,0);
}
if(!strcmp(bname,"Patrick"))
{
PutPlayerInVehicle(i,RacetrackBoat,0);
}
}
}
}
Here's an example of one NPC script:
pawn Код:
#define RECORDING "TrainFromSFw" //Train which is in SF at start
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.
#include <a_npc>
main(){}
public OnRecordingPlaybackEnd()
{
StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}
public OnNPCEnterVehicle(vehicleid, seatid)
{
StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}
public OnNPCExitVehicle()
{
StartRecordingPlayback(RECORDING_TYPE, RECORDING);
}