[NPC HELP] The NPC spawns underground and just stays there;
#1

Hello, I have followed a tutorial to create an NPC in my server and when the gamemode starts or restarts the NPC spawns in the vehicle and just stays underground.

I added this variable in my gamemode:

Код:
new MyFirstNPCVehicle;
& put this under OnPlayerSpawn:

Код:
public OnPlayerSpawn(playerid)
{
  if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  {
    new npcname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
    if(!strcmp(npcname, "Graham_Jones", 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 this under OnGameModeInit:

Код:
ConnectNPC("Graham_Jones","mynpc");
  MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Here is the recording I created for the NPC which I saved in the 'npcmodes' folder as "mynpc.pwn":

Код:
#define RECORDING "mynpc" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 1 //1 for in vehicle and 2 for on foot.

#include <a_npc>
main(){}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn() StartRecordingPlayback(RECORDING_TYPE, RECORDING);
#endif
And there's also a mynpc.rec in npcmodes/recordings.

Please help, I can't figure it out.
Reply
#2

Maybe you shouldnt start recording playback when NPC spawns, becauz it will start once NPC is put in the vehicle.
Reply
#3

Happens to me too it spwns at position 0 (under the map, somwhere in the middle of San Andreas)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)