SA-MP Forums Archive
Having problems with bots - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Having problems with bots (/showthread.php?tid=481122)



Having problems with bots - DJGama101 - 14.12.2013

Hi. Recently i wanted to add some train bots to my server. Bots are connecting, spawning and they are driving the trains for about 30 seconds and then they are dissapearing. After that, again for 30 second they are moved to trains and all situation is beaing repeated all time.

Here is my code connected with bots:

Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(IsPlayerNPC(playerid))
    {
        if(!strcmp(PlayerName(playerid), "[TWBOT]Czesiek", false))
        {
            SetSpawnInfo(playerid, 0, 0, 1462.0745, 2630.8787, 10.8203, 0.0, 0, 0, 0, 0, 0, 0);
        }
        else if(!strcmp(PlayerName(playerid), "[TWBOT]Bogdan", false))
        {
            SetSpawnInfo(playerid, 0, 0, -1942.7950, 168.4164, 27.0006, 0.0, 0, 0, 0, 0, 0, 0);
        }
        else if(!strcmp(PlayerName(playerid), "[TWBOT]Szefuniu", false))
        {
            SetSpawnInfo(playerid, 0, 0, 1700.7551, -1953.6531, 14.8756, 0.0, 0, 0, 0, 0, 0, 0);
        }
        return 1;
    }
    return 0;
}
And code for public OnPlayerSpawn

Код:
   if(IsPlayerNPC(playerid))
    {
        if(!strcmp(PlayerName(playerid), "[TWBOT]Czesiek", false))
        {
            PutPlayerInVehicle(playerid, czesiek, 0);
            SetPlayerColor(playerid, COLOR_TRUCKERS);
        }
        else if(!strcmp(PlayerName(playerid), "[TWBOT]Bogdan", false))
        {
            PutPlayerInVehicle(playerid, bogdan, 0);

            SetPlayerColor(playerid, COLOR_TRUCKERS);
        }
        else if(!strcmp(PlayerName(playerid), "[TWBOT]Szefuniu", false))
        {
            PutPlayerInVehicle(playerid, szefuniu, 0);
            SetPlayerColor(playerid, COLOR_TRUCKERS);
        }
    }
Any ideas?