Creating NPCs with RNPC.inc
#2

well you could find alot of filterscripts,which create NPCs ingame,and keep this in mind,the easiest way to get npcs is to use npc_record filterscript,just load it and go ingame,write /record [filename]and do whatever you want the npc to do,when you finish do /finishrecord ,then go to scriptfiles and copy the filename you wrote and paste it at npcmodes/records
then go to pawno and make a new .pwn folder and put this in it:
pawn Код:
#define RECORDING "the filename you saved" //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
then compile it and save it in npcmodes,and under ongamemodeinit:
pawn Код:
public OnGameModeInit()
{
  ConnectNPC("name of the npc","filename");
  return 1;
}
and OnPlayerSpawn,detect if the player is npc which means if it's the npc you created:
pawn Код:
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, "npcname", true)) //Checking if the NPC's name is the name of your npc,the one you created
    {
      // this is the npc,do whatever to him,if you want him to drive a car put him in the car.. or do anything you want
    }
    return 1;
  }
  return 1;
}
Reply


Messages In This Thread
Creating NPCs with RNPC.inc - by Galletziz - 02.05.2014, 05:03
Re: Creating NPCs with RNPC.inc - by XK - 02.05.2014, 07:52
Re: Creating NPCs with RNPC.inc - by Galletziz - 02.05.2014, 08:10
Re: Creating NPCs with RNPC.inc - by XK - 02.05.2014, 08:13
Re: Creating NPCs with RNPC.inc - by Galletziz - 02.05.2014, 08:28
Re: Creating NPCs with RNPC.inc - by XK - 02.05.2014, 08:30
Re: Creating NPCs with RNPC.inc - by Galletziz - 02.05.2014, 08:33

Forum Jump:


Users browsing this thread: 1 Guest(s)