[FilterScript] Jochem's Advanced NPC Creator
#1

Jochem's Advanced NPC Creator
Hello,

I've made my second Filterscript; Advanced NPC Creator

What does it do and is special about it?
The normal npc_record script included in the server package only allows you to record the npc, and nothing more. My script also creates the script which should be put in "server_root/npcmodes" and it also creates the "OnPlayerSpawn script if you recorded in a vehicle!

Examples?
Of course. Let's say I recorded NPC 'incar.rec'. There will be three files in scriptfiles;
- incar.rec
- incar.pwn
- incar.txt

incar.rec is the file you recorded, this file should be moved to 'server_root/npcmodes/recordings'.
incar.pwn is the file which controls the recording. It should be moved to 'server_root/npcmodes'. It contains this, when you named the file 'incar'.
pawn Код:
#define RECORDING "incar"
#define RECORDING_TYPE 1
 
#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
incar.txt contains script to connect and eventually put the NPC in a vehicle, in case it's recorded in a vehicle.
pawn Код:
// Put the script down here in your gamemode. You might have to merge functions. Also, don't forget to replace 'npc_name_here' with the name of the NPC ingame.

new npc_name_here_vehicle;

public OnGameModeInit()
{
    npc_name_here_vehicle = CreateVehicle(558,0.0,0.0,0.0,0.0,-1,-1,-1);
    ConnectNPC("npc_name_here",incar);
    return 1;
}
 
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid,name,sizeof(name));
        if(!strcmp(name,"npc_name_here",false))
        {
            PutPlayerInVehicle(playerid,npc_name_here_vehicle,0);
        }
        return 1;
    }
    return 1;
}
Don't forget to replace the 'npc_name_here' things!

Код:
Download
v1.0 (24/08/2011): Pastebin
Credits:
- Dracoblue; DCMD
- KC; For learning me how to use a NPC about a year ago with this tutorial
- Myself: Making the script. DO NOT RELEASE THIS WITHOUT MY PERMISSION.

I'd really like to hear your answers - what can be improved?

Jochem
Reply


Messages In This Thread
Jochem's Advanced NPC Creator - by Jochemd - 24.08.2011, 11:54
Re: Jochem's Advanced NPC Creator - by TheArcher - 24.08.2011, 12:02
Re: Jochem's Advanced NPC Creator - by Jochemd - 24.08.2011, 12:04
Re: Jochem's Advanced NPC Creator - by iMonk3y - 24.08.2011, 12:45
Re: Jochem's Advanced NPC Creator - by Jochemd - 24.08.2011, 12:47
Re : Jochem's Advanced NPC Creator - by Naruto_Emilio - 24.08.2011, 19:07
Re: Re : Jochem's Advanced NPC Creator - by Jochemd - 24.08.2011, 19:10
Re: Jochem's Advanced NPC Creator - by misho1 - 10.11.2011, 00:12
Re: Jochem's Advanced NPC Creator - by misho1 - 10.11.2011, 02:17
Re: Jochem's Advanced NPC Creator - by Salvator_Salieri - 26.11.2014, 12:23
Re: Jochem's Advanced NPC Creator - by Jochemd - 03.12.2014, 08:24

Forum Jump:


Users browsing this thread: 3 Guest(s)