Connecting a NPCs
#1

I'm stuck with connecting NPC to script.I've started new script (gamemode)
and now I want to connect NPC to my script. But how?

Im totally new in 0.3 so I don't know how to do it. I read NPC tutorial about 4-5 times.
There's a list what I want to connect

\npcmodes\recordings\at400_ls_to_lv_x1.rec
\npcmodes\recordings\at400_lv_to_sf_x1.rec
\npcmodes\recordings\at400_sf_to_ls_x1.rec
\npcmodes\recordings\train_ls_to_sf1.rec
\npcmodes\recordings\train_lv_to_ls1.rec
\npcmodes\recordings\train_sf_to_lv1.rec

(They're come with server package)
Reply
#2

You need to have your NPC script at /npcmodes/ directory and you need to use ConnectNPC-function of course.
Reply
#3

Quote:
Originally Posted by Don Correlli
You need to have your NPC script at /npcmodes/ directory and you need to use ConnectNPC-function of course.
And just
ConnectNPC(bla bla);
under OnGameModeInit and that's it?
Reply
#4

I can't explain better than it has been explained here: http://forum.sa-mp.com/index.php?topic=119947.0
Reply
#5

I did it, but when I start server,there's a

[npc:join]AT400_LOS_SANTOS has joined the server <0:127.0.0.1>
[npc:join]AT400_LAS_VENTURAS has joined the server <1:127.0.0.1>
[npc:join]AT400_SAN_FIERRO has joined the server <2:127.0.0.1>

but I have trains too and there's no

[npc:join]VLAK_LS has joined the server ....

Maybe because I'm using AddStaticVehicleEx for train, not CreateVehicle?
Why I am using AddStaticVehicleEx? Because when I start server with CreateVehicle (train1 = CreateVehicle(...)) then it write
You can create train only withe AddStaticVehicle/Ex or something like that.

Here's my code:

pawn Code:
new bot1,bot2,bot3,bot4,bot5,bot6;
OnGameModeInit
pawn Code:
ConnectNPC("AT400_LOS_SANTOS","at400_ls");
    ConnectNPC("AT400_LAS_VENTURAS","at400_lv");
    ConnectNPC("AT400_SAN_FIERRO","at400_sf");
    ConnectNPC("VLAK_LS","VLAK_ls");
    ConnectNPC("VLAK_LV","VLAK_lv");
    ConnectNPC("VLAK_SF","VLAK_sf");
   
    bot1 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_LOS_SANTOS
    bot2 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_LAS_VENTURAS
    bot3 = CreateVehicle(577, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // AT400_SAN_FIERRO
    bot4 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_LS
    bot5 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_LV
    bot6 = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); // VLAK_SF
OnPlayerSpawn
pawn Code:
if(IsPlayerNPC(playerid))
    {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname));
    if(!strcmp(npcname, "AT400_LOS_SANTOS", true))
    {
      PutPlayerInVehicle(playerid, bot1, 0);
      return 1;
    }
    if(!strcmp(npcname, "AT400_LAS_VENTURAS", true))
    {
      PutPlayerInVehicle(playerid, bot2, 0);
      return 1;
    }
    if(!strcmp(npcname, "AT400_SAN_FIERRO", true))
    {
      PutPlayerInVehicle(playerid, bot3,0);
      return 1;
        }
        if(!strcmp(npcname, "VLAK_LS", true))
    {
      PutPlayerInVehicle(playerid, bot4, 0);
      return 1;
    }
    if(!strcmp(npcname, "VLAK_LV", true))
    {
      PutPlayerInVehicle(playerid, bot5, 0);
      return 1;
    }
    if(!strcmp(npcname, "VLAK_SF", true))
    {
      PutPlayerInVehicle(playerid, bot6,0);
      return 1;
        }
    return 1;
    }
EDIT: I solve the problem when I was writing this post, problem is because npc script doesn't call VLAK_ls , but train_ls (train_lv,train_sf).
Admins can lock this topic!
Reply
#6

Can you help me set up bot`s for me?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)