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


Messages In This Thread
Problem with my NPCs - by melcal05 - 05.11.2010, 15:59
Re: Problem with my NPCs - by MadeMan - 05.11.2010, 16:36
Re: Problem with my NPCs - by Dime - 05.11.2010, 16:40
Re: Problem with my NPCs - by melcal05 - 06.11.2010, 02:42
Re: Problem with my NPCs - by melcal05 - 06.11.2010, 16:52
Re: Problem with my NPCs - by melcal05 - 08.11.2010, 13:46

Forum Jump:


Users browsing this thread: 1 Guest(s)