SA-MP Forums Archive
possible to control a npc in a vehicle? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: possible to control a npc in a vehicle? (/showthread.php?tid=264358)



possible to control a npc in a vehicle? - Owenlishious - 25.06.2011

Hi,

I don't really have that much experience with npc's... I know how to create them, but i need to know if its possible to control a bot that is in a vehicle...for example, if i type a command and the bot will start firing rockets (in a hydra of course )

thank you


Re: possible to control a npc in a vehicle? - L84S - 25.06.2011

Код:
#define RECORDING_TYPE 1  //1 for in vehicle and 2 for on foot
have yet to add
Код:
new MyFirstNPCVehicle / / Global variable?
Public OnGameModeInit ()
{
   print ("my gamemode");
   ConnectNPC ("MyFirstNPC", "mynpc");
   MyFirstNPCVehicle CreateVehicle = (400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
   return 1;
}
Also add another

Код:
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, "MyFirstNPC", 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;
  }
  //Other stuff for normal players goes here!
  return 1;
}
That part you need to change the rest bequeath the same as when he walk
I hope you will help
L84S