SA-MP Forums Archive
[Solved] Bots Randomly Leaves Vehicle.. - 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: [Solved] Bots Randomly Leaves Vehicle.. (/showthread.php?tid=118829)



[Solved] Bots Randomly Leaves Vehicle.. - SiJ - 05.01.2010

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:
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);
            }
        }
    }
}
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:
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);
}



Re: [Unsolved] Bots randomly stops working... - SiJ - 05.01.2010

bump..
4th page, no replies and this is a little.. urgent..


Re: Strange problem with bots.. They don't obey me.. They think on their own.. :) - boelie - 05.01.2010

Did you make createvehicle for them or addstaticvehicle ?


Re: Strange problem with bots.. They don't obey me.. They think on their own.. :) - SiJ - 05.01.2010

Quote:
Originally Posted by boelie
Did you make createvehicle for them or addstaticvehicle ?
AddStaticVehicle.. But I don't think something is wrong with vehicles, cause they work for like 10-20mins.. :P


Re: [Help] I got a function for my server bots.. It should work, right? - Nava - 06.01.2010

I got the same problem ...

...does anyone knows how to fix this?


Re: [Help] I got a function for my server bots.. It should work, right? - SiJ - 06.01.2010

Now we're two having the same problem.. But if somebody didn't understood, I'm asking why that function (posted in 1st post) doesn't work?


Re: [Help] I got a function for my server bots.. It should work, right? - Oxside - 06.01.2010

First your identation...:S
Try CreateVehicle Instead of AddStaticVehicle


Re: [Help] I got a function for my server bots.. It should work, right? - SiJ - 06.01.2010

Quote:
Originally Posted by Oxside
First your identation...:S
Try CreateVehicle Instead of AddStaticVehicle
Ok.. I will try if you think it helps me..

It didn't helped, but I just started my server without any FS.. Everything works.. So that means ther is a problem with my FSs.. I'll find solution myself.. Thanks for help..