-
Notifications
You must be signed in to change notification settings - Fork 31
Home
- A SA-MP version which is compatible with the latest FCNPC version. Both the latest non-0.3.DL SA-MP version and the latest 0.3.DL SA-MP version are supported.
- Optionally, foreach, to add the ability to use:
foreach (new npcid : FCNPC)
.
The latest version can be found on the releases page for both the latest non-0.3.DL SA-MP version and the latest 0.3.DL SA-MP version.
- Add a
maxnpc
line in theserver.cfg
file if one does not already exist and set it to the maximum amount of NPCs you want. Make sure it is not more thanmaxplayers
, else increase that value. - Create a
plugins
folder in the root of the server directory if one does not already exist. - Put the
FCNPC.dll
file (for Windows) or theFCNPC.so
file (for Linux) in theplugins
folder if you're using the non-0.3.DL SA-MP version, otherwise put theFCNPC-DL.dll
file (for Windows) or theFCNPC-DL.so
file (for Linux) in theplugins
folder if you're using the 0.3.DL SA-MP version. - Add a
plugins
line in theserver.cfg
file if one does not already exist. - Add
FCNPC
(for Windows) orFCNPC.so
(for Linux) to that line if you're using the non-0.3.DL SA-MP version, otherwise addFCNPC-DL
(for Windows) orFCNPC-DL.so
(for Linux) to that line if you're using the 0.3.DL SA-MP version. If there is already another plugin on that line, separate the plugins by using a space between them. - Put the
FCNPC.inc
file in thepawno/include
folder. It supports both the non-0.3.DL SA-MP version and the 0.3.DL SA-MP version. - Put
#include <FCNPC>
in the filterscript/gamemode you want to use the plugin in. - Enable lag compensation in
server.cfg
if not done already. This is to ensure that OnPlayerWeaponShot will be called, and as a result NPC vehicle damage will work. - If your NPCs will use MapAndreas, initialize MapAndreas in your gamemode by putting the following line under OnGameModeInit if not done already. You also don't need to load the MapAndreas plugin separately in
server.cfg
, since FCNPC loads this automatically!
MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
- If your NPCs will use ColAndreas, initialize ColAndreas in your gamemode by putting the following line under OnGameModeInit if not done already. You also don't need to load the ColAndreas plugin separately in
server.cfg
, since FCNPC loads this automatically!
CA_Init();
This example filterscript creates an NPC named FirstNPC
and spawns him at the center of the map. More advanced examples can be found here.
#define FILTERSCRIPT
#include <a_samp>
#include <FCNPC>
new myFirstNPC = INVALID_PLAYER_ID;
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
myFirstNPC = FCNPC_Create("FirstNPC");
FCNPC_Spawn(myFirstNPC, 0, 0.0, 0.0, 3.1);
return 1;
}
public OnFilterScriptExit()
{
FCNPC_Destroy(myFirstNPC);
myFirstNPC = INVALID_PLAYER_ID;
return 1;
}
#endif
If you would like to help develop this plugin, you need to download the sources and build the project.
To download the sources, use the following git command:
git clone --recursive https://github.com/ziggi/FCNPC.git
Note the use of the --recursive
argument, because this repository contains submodules.
To build the project you can use Visual Studio. To generate the project you can use CMake.
On Windows, execute the following commands. This example is for Visual Studio 15 2017:
cd FCNPC
mkdir build
cd build
cmake .. -G "Visual Studio 15 2017"
On Linux, execute the following commands:
cd FCNPC
mkdir build
cd build
cmake ..
make
Wiki written by Freaksken.