24.08.2011, 11:54
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
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;
}
Код:
Download v1.0 (24/08/2011): Pastebin
- 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