SA-MP Forums Archive
Train Bot problem. - 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)
+--- Thread: Train Bot problem. (/showthread.php?tid=396913)



Train Bot problem. - Kethrios - 02.12.2012

Hello !

Well I have a little problem with my Train bot.
First of all, he crash when he's connecting. That's all. That's the problem.

The thing is.... How can I fix it ?
Yes the OnGameModeInit and OnPlayerSpawn are set up, and I use AddStaticVehicleEx, not CreateVehicle.
And yes the record is OK

Thank you for helping !


Re: Train Bot problem. - Lz - 02.12.2012

Usually bots don't connect because of a firewall


Re : Train Bot problem. - Kethrios - 02.12.2012

But the others can connect.


Re: Train Bot problem. - Lz - 02.12.2012

Hmm paste all your bots script, Im out in a second for 2 hours but when im back i will take a look


Re : Train Bot problem. - Kethrios - 02.12.2012

Okat so the problem is half solved.
The bot still crash.

The train spawn, but there is 2 of them spawning.... Dunno why.

I need some help me.


Re: Train Bot problem. - NoahF - 02.12.2012

Post the NPC script.


Re : Train Bot problem. - Kethrios - 02.12.2012

pawn Код:
forward createNpc();
forward create_Train(id);
pawn Код:
new VTrain01;
OnGameModeInit :
pawn Код:
VTrain01 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
OnPlayerSpawn :
pawn Код:
else if(!strcmp(playername,"Train_01",true))
        { //Agent Fbi protection
            print("[Npc] Initialisation - Train 01");
            SetPlayerSkin(playerid,255);
            engineOn[1] = true;
            car_Engine(1);
            PutPlayerInVehicle(playerid, VTrain01, 0);
            GetVehicleParamsEx(538,engine,lights,alarm,doors,bonnet,boot,objective);
            SetCarChange(1,engine,1,alarm,doors,bonnet,boot,objective);
        }

createNpc :
pawn Код:
ConnectNPC("Train_01","train");
create_Train(1);

public create_Train(id) :
pawn Код:
{
    new botname[64];
    format(botname,sizeof(botname),"Train_%d",id);
    ConnectNPC(botname,"train");
    id++;
    if(id < 7)
    {
        SetTimerEx("create_Train", 124000, false, "d", id);
    }
}



Re : Train Bot problem. - Kethrios - 03.12.2012

Little up, still need some help please.


Re: Train Bot problem. - Konstantinos - 03.12.2012

Follow this tutorial <[Tutorial] Creating a new NPC by kc. If you have registration system, return true to prevent NPC from register part, Most of the times, your antivirus/firewall request you from allowing these NPCs connect to the server, for example on localhost, so you should allow them. Last, makes sure you have moved the .rec and the miniscript to the correct folders.


Re : Train Bot problem. - Kethrios - 03.12.2012

Exactly the SAME PROBLEM even when I use this tutorial.
The train npc crash, and the train spawned.

Even when I use
pawn Код:
if(IsPlayerNPC(playerid))
    {
        return 1;
    }