Problem with my NPCs
#1

Hi there and i've just created 2 NPCs as a driver but they spawned somewhere underground in LS countryside instead of getting the way the record does.


Код:
#include <a_samp>

new MyFirstNPCVehicle, AnotherVehicleID, ThirdVehicleID; //Global variable!
public OnFilterScriptInit()
{
  print("my filterscript");
  ConnectNPC("Test","Unity");
  MyFirstNPCVehicle = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

  ConnectNPC("Street_Racer","Cranberry");
  AnotherVehicleID = AddStaticVehicleEx(538, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);

  //ConnectNPC("[NFS]RaCeR","racer2");
  //ThirdVehicleID = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
  return 1;
}



public OnPlayerRequestClass(playerid, classid)
{
	if(!IsPlayerNPC(playerid))
	return 0; // We only deal with NPC players in this script

	new playername[64];
	GetPlayerName(playerid,playername,64);

	if(!strcmp(playername,"Test",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"Street_Racer",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1);
	}
	else if(!strcmp(playername,"[NFS]RaCer",true))
	{
	  SetSpawnInfo(playerid,69,61,0.0,0.0,0.0,0.0,-1,-1,-1,-1,-1,-1); //change the skin id if you want ( 69 is a pilot skin id)
	}

	return 1;
}




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, "Test", 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;
    }
    if(!strcmp(npcname, "Street_Racer", true))
    {
      PutPlayerInVehicle(playerid, AnotherVehicleID, 0);
      return 1;
    }

    if(!strcmp(npcname, "[NFS]RaCer", true))
    {
      PutPlayerInVehicle(playerid, ThirdVehicleID, 0);
      return 1;
    }
    return 1;
  }
  return 1;
}
Reply
#2

Show the NPC script too.
Reply
#3

be sure you made every steep by this tutorial
https://sampforum.blast.hk/showthread.php?tid=95034
Reply
#4

Here's one of the NPC Script.
Код:
#define RECORDING "Thunder" //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
I DID follow the tutorial.
Reply
#5

Seeking for some help
Reply
#6

anyone plz help...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)