-
Notifications
You must be signed in to change notification settings - Fork 31
Home
Everything in the plugin is prefixed with FCNPC_
.
Questions can be asked in the forum thread, or in the Russian forum thread.
- A samp version which is compatible with the latest FCNPC version.
- Optionally, MapAndreas v1.2.1.
- Optionally, foreach, to add the ability to use:
foreach (new npcid : FCNPC)
.
The latest version can be found on the releases page.
- 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. - 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 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. - 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 as follows if not done already in one of your scripts in which you want to use FCNPC. If your script is a gamemode, put the following lines under OnGameModeInit. If it is a filterscript, put them under OnFilterScriptInit.
MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
FCNPC_InitMapAndreas(MapAndreas_GetAddress());
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 MyTestNPC = INVALID_PLAYER_ID;
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
MyTestNPC = FCNPC_Create("FirstNPC");
FCNPC_Spawn(MyTestNPC, 0, 0.0, 0.0, 3.1);
return 1;
}
public OnFilterScriptExit()
{
FCNPC_Destroy(MyTestNPC);
MyTestNPC = 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.