About NPCs
#1

Hello Guys. There is a small problem I have, I have tryed to get a NPC on my local server but it does not work. I see where the NPC connects (in the console) but he won't spawn.

As kc said, we can put If(IsPlayerNpc(playerid))return 1; at the nessary callbacks. I put mine on OnPlayerRequestSpawn and OnPlayerRequestClass. Also I tryed it with OnPlayerConnect but non seems to work. The npc connects just does not spawn.

EDIT: I went in the server and teleported to id 0 and he was there. but just standing at the place.

The NPC is not in a vehicle.
Reply
#2

Is this in a fliterscript or a gamemode?

and the recording file should be in the right place this can cause it to.
Reply
#3

Gamemode. He is at the spawn just not doing anything and it is an on foot npc.
Reply
#4

Go back and do the OnGameModeInit part again like kc quoted. But what I recommend is you put every ConnectNPC line as the very first line under OnGameModeInit.

Also:
pawn Код:
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
    {
        new npcname[MAX_PLAYER_NAME];
        new Text3D:label[MAX_PLAYERS];
        GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
        if(!strcmp(npcname, "namehere", true)) //Checking if the NPC's name is MyFirstNPC
        {
            PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
            return 1;
        }
put these functions as the first ones under OnPlayerSpawn and maybe your bot shouldn't be in the spawn point.
Reply
#5

The bot should not be in a vehicle. Just normal running and doing stuff.

EDIT: I found my problem. #define RECORDING_TYPE 1 and not 2. Well he was just standing there waiting for his vehicle to arrive xD. 1 is for InVehicle and 2 is for OnFoot. Thanks anyways.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)